Import newest csv file in directory

前端 未结 3 1587
慢半拍i
慢半拍i 2021-01-14 16:47

Goal:
- Import the newest file (.csv) from a local directory into R

Goal Details:
- A csv file is uploaded to a folder dail

3条回答
  •  [愿得一人]
    2021-01-14 17:32

    A more efficient solution using dplyr/magrittr

    pacman::p_load(magrittr)
    
    path <- list.files(path = directory,
                       pattern = "csv$",
                       full.names = TRUE) %>%
      extract(which.max(file.mtime(.)))
    

提交回复
热议问题