Looping a function over multiple files

前端 未结 1 1239
小鲜肉
小鲜肉 2021-01-16 15:44

I wrote a simple function:

myfunction <- function(fileName, stringsAsFactors=TRUE,                 
                   check.names=FALSE,               
          


        
相关标签:
1条回答
  • 2021-01-16 16:28

    Like @Arun pointed out, you are trying to run your function twice: once on the files and once one the data frames you have created... Instead, your code should look like this:

    files <- list.files(pattern = ".txt")
    mylist <- lapply(files, myfunction) 
    
    0 讨论(0)
提交回复
热议问题