filepath <- paste0("path")
parameters <- list(header=T,row.names=1,sep="\t",check.names=F,stringsAsFactors=F)
input<- read.table(filepath,parameters)
但是,我收到一条错误消息:
Error in !header : invalid argument type
当参数没有像这样放在列表中时它工作正常
filepath <- paste0("path")
input <- read.table(filepath,header=T,row.names=1,sep="\t",check.names=F,stringsAsFactors=F)
由于我导入了很多数据并且参数是相同的,我想知道如何在read.table
函数中传递参数。
最佳答案
尝试do.call
。它允许您提供参数列表。将 filepath
添加到参数变量:
do.call(read.table, c(filepath, parameters))
关于r - 在 read.table( ) 中传递参数列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33226064/