hohiyan

ptt-r_20220525

May 25th, 2022 (edited)
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.38 KB | None | 0 0
  1. # 用 readxl::read_xlsx 可以指定欄位資料格式
  2.  
  3. library(purrr)
  4. library(readxl)
  5.  
  6. path <- "your/file/path/"
  7.  
  8. files <- list.files(filepath, pattern = "*.xlsx$", full.names = TRUE)
  9.  
  10. all_files <- files |>
  11.   map(~ read_xlsx(file.path(filepath, .),
  12.                   col_types = cols(
  13.                     `7.計劃日` = col_character())
  14.                   )) |>
  15.   reduce(rbind)
Add Comment
Please, Sign In to add comment