首页 > 解决方案 > 从 R 中的文件夹中读取具有特定扩展名的文件

问题描述

我想使用函数 read.table 读取扩展名为 .output 的文件。我使用了 pattern=".output" 但它不正确。有什么建议么?

在此处输入图像描述

标签: r

解决方案


例如,这里介绍了如何读取扩展名为“.output”的文件并创建表列表

 list.filenames <- list.files(pattern="\\.output$")
 trialsdata <- lapply(list.filenames,read.table,sep="\t")

或者,如果您只想手动一次阅读它们,只需在文件名参数中包含扩展名。

read.table("ACF.output",sep=...)

推荐阅读