如何将不同文件夹中的多个.txt文件导入R中的同一数据对象中?

时间:2019-02-24 04:15:10

标签: r import

我有多个.txt文件,我想导入到R中的同一对象中。但是,每个文件都位于不同的文件夹中。当我运行下面的代码时,它生成一个矩阵。如何进入物体?

library(readtext)

processFile <- function(f) {
    df <- readtext(f)
}

text.files <- list.files(path=training_folder, recursive=T, pattern="*.txt", full.names = T)
result     <- sapply(text.files, processFile)

0 个答案:

没有答案