美文网首页
日常debug

日常debug

作者: CrimsonUMO | 来源:发表于2022-09-19 11:07 被阅读0次

变量名错误

Error in df$group : object of type 'closure' is not subsettable

非常常见的报错,这个是因为变量df不存在,所以没有子集。这种非常明确指出错误的变量位置的还是比较好排查的

内存报错

Error: cannot allocate vector of size 109.7 Mb

这一类报错通常跟内存不够相关。可以尝试在run报错的命令前,加run一条

gc()

然后再run之前的命令就可以了。

生存曲线报错

用ggsurvplot画生存曲线的时候出现如下报错

Error in .get_data(fit, data = data, complain = FALSE) : 
  The `data` argument should be provided either to ggsurvfit or survfit.

我这里是赋值有问题。前面的代码是这样的:

fit <- survfit(Surv(OS, vitus)~score_group, data=data)

改了变量名之后就好了,就是说这里变量的变量名不能是“data”

fit <- survfit(Surv(OS, vitus)~score_group, data=surv)

KEGG富集分析报错

> kegg <- enrichKEGG(gene = hg$ENTREZID, 
+                    organism = 'mmu', 
+                    keyType = 'kegg', 
+                    pvalueCutoff = 0.05, 
+                    pAdjustMethod = 'BH', 
+                    minGSSize = 3, 
+                    maxGSSize = 500, 
+                    qvalueCutoff = 0.2, 
+                    use_internal_data = FALSE)
Reading KEGG annotation online:

fail to download KEGG data...
Error in download.KEGG.Path(species) : 
  'species' should be one of organisms listed in 'http://www.genome.jp/kegg/catalog/org_list.html'...
In addition: Warning message:
In utils::download.file(url, quiet = TRUE, method = method, ...) :
  URL 'https://rest.kegg.jp/link/mmu/pathway': status was 'Failure when receiving data from the peer'

运行如下命令:

> install.packages("R.utils")
将程序包安装入‘C:/Users/LeiLei/Documents/R/win-library/4.1’
(因为‘lib’没有被指定)
trying URL 'https://mirrors.pku.edu.cn/CRAN/bin/windows/contrib/4.1/R.utils_2.12.0.zip'
Content type 'application/zip' length 1411717 bytes (1.3 MB)
downloaded 1.3 MB

package ‘R.utils’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\LeiLei\AppData\Local\Temp\RtmpacJ75K\downloaded_packages
> 
> R.utils::setOption("clusterProfiler.download.method",'auto')

之后再遇到这类报错直接运行第二条命令就可以

相关文章

网友评论

      本文标题:日常debug

      本文链接:https://www.haomeiwen.com/subject/hwbeurtx.html