錯誤

2017-08-02 20 views
0

我試圖用ggtexttable功能從ggpubr用於創建發佈就緒表。我有一個數據幀:錯誤

dput(df)  
structure(list(feature = list("start_codon", "stop_codon", "intergenic", 
     "3UTR", "5UTR", "exon", "intron", "ncRNA", "pseudogene"), 
     observed = list(structure(1L, .Names = "start_codon"), structure(1L, .Names = "stop_codon"), 
      structure(418L, .Names = "intergenic"), structure(48L, .Names = "3UTR"), 
      structure(28L, .Names = "5UTR"), structure(223L, .Names = "exon"), 
      structure(578L, .Names = "intron"), structure(20L, .Names = "ncRNA"), 
      structure(1L, .Names = "pseudogene")), expected = list(
      0.286, 0.286, 369.02, 72.461, 33.165, 257.869, 631.189, 
      48.491, 3.172), fc = list(3.5, 3.5, 1.1, 0.7, 0.8, 0.9, 
      0.9, 0.4, 0.3), test = list("enrichment", "enrichment", 
      "enrichment", "depletion", "depletion", "depletion", 
      "depletion", "depletion", "depletion"), sig = list("F", 
      "F", "T", "T", "F", "T", "T", "T", "F"), p_val = list(
      "0.249", "0.249", "0.00186", "0.00116", "0.209", "0.00814", 
      "0.00237", "<1e-04", "0.175")), class = "data.frame", row.names = c(NA, 
    -9L), .Names = c("feature", "observed", "expected", "fc", "test", 
    "sig", "p_val")) 

當我試圖把它變成一個表:

ggtexttable(df)

我得到的錯誤:

Error in (function (label, parse = FALSE, col = "black", fontsize = 12, : unused arguments (label.feature = dots[[5]][ 1 ], label.observed = dots[[6]][ 1 ], label.expected = dots[[7]][ 1 ], label.fc = dots[[8]][ 1 ], label.test = dots[[9]][ 1 ], label.sig_val = dots[[10]][ 1 ], label.p_val = dots[[11]][ 1 ])

有誰知道什麼可能是造成這個?

這工作得很好:

df <- head(iris) 
ggtexttable(df) 

enter image description here

+0

你可以在'dput發表您的數據()'格式而不是僅僅複製和粘貼... –

+0

@Malvina_a - 感謝 - 看到更新 – fugu

回答

1

我發現這是會爲你工作的問題和解決方案。首先你的數據格式不正確(嵌套表)這就是爲什麼你收到此錯誤試圖顯示它。您可以檢查什麼是數據集的格式很容易地通過在控制檯粘貼:str(data)

這裏是解決你的數據轉換爲data.frame

first.step <- lapply(data, unlist) 
second.step <- as.data.frame(first.step, stringsAsFactors = F) 

然後你就可以方便的使用功能ggtexttable(second.step),它用你的數據顯示錶格。