Reading all scripts and data files from multiple folders

后端 未结 3 1060
小鲜肉
小鲜肉 2020-12-23 17:37

I have two folders, folder1 and folder2 with around 200 files each that are either *rda or *R. I want to read all of the

3条回答
  •  独厮守ぢ
    2020-12-23 18:17

    If you want to use tidyverse instead, you could use the map function to simplify:

    my_path <- c("/path/to/files/")             # set your path
    source_files <- list.files(my_path, "*.R$")  # locate all .R files
    map(paste0(my_path, source_files), source)  # source all your R scripts!
    

提交回复
热议问题