Reading multiple files from a directory, R

前端 未结 2 1533
闹比i
闹比i 2021-02-03 16:29

I am having difficulty with one step in my code to read in a folder of text files and convert it to a dtm. The problem is that, for some reason, my computer is only able to int

相关标签:
2条回答
  • 2021-02-03 16:34

    List.filesonly gives you the file names, not file names with full path. Try

    files <- as.character(list.files(path="[file path]"))
    readLines(paste("[file path]",.Platform$file.sep,files[1],sep=""))
    
    0 讨论(0)
  • 2021-02-03 16:53
    directory <- "C://temp"  ## for example
    filenames <- list.files(directory, pattern = "*.*", full.names = TRUE)
    
    0 讨论(0)
提交回复
热议问题