r - 在 read.table( ) 中传递参数列表

标签 r read.table

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/

相关文章:

r - 算法四舍五入到 R 中的下一个数量级

r - 如何避免 : read. 表截断以 0 开头的数值

r - 如何读取缺少第一个列名的数据表?

r - 使用 read.table 时监控 R 数据加载进度

r - 根据条件填充多列的行

css - 如何使用 rvest 从搜索结果 url 中提取 id 名称? (CSS 选择器不起作用)

r - 在 R 中,如何使用自定义行尾 (eol) 读取文件

R:读取.tab文件

R - stackplot/barplot 随时间变化的比例

R Plotly - 绘制多条回归线