環境:windows10
情境:使用readr::read_csv 無法讀取 中文路徑,建議改用 read.table
# -----------readr::read_csv 無法讀取 中文路徑
# readcsv <- function(filename) {
# library(readr)
# rescsv <- read_csv(filename,
# locale = locale(encoding = "BIG5"))
# return(rescsv)
# }
# -------------改用 read.table
readcsv <- function(filename){
rescsv <- read.table(filename, header=TRUE,
sep=",", stringsAsFactors=FALSE)
return(rescsv)
}
filenames
# ----------- processing
data.list <- lapply(filenames, readcsv)
data.df <- do.call("rbind", data.list)