在尝试使用超过最大整数 (.Machine$integer.max = 2147483647) 的列导入数据时遇到问题。使用 readr 的 read_csv 我相信它是作为 NA 导入的,而不是四舍五入。复杂性来自尝试使用 rbindlist 导入多个 csv。
这是我当前的设置:
load_df_path <- file.path(".../dffolder") #path to folder
df_path_files <- list.files <- (load_df_path, full.names = TRUE) #list files in path
df <- rbindlist(lapply(df_path_files, read_csv)) # read in csvs using readr
如何编写最后一行以导入 csvs 并将列“数量”转换为字符而不是整数?
这是我尝试过的一些事情,但没有运气...
## This gets error: Error in switch(tools::file_ext(path)....
df <- rbindlist(lapply(df_path_files, read_csv(df_path_files, col_types = list(amount = col_character()))))
## recreate read_csv and changed col_types = NULL to the above but getting the warning
## Error in FUN(X[[i]], ...) : could not find function "read_delimited"
tl;dr - 需要帮助导入 csvs 列表,同时将特定列更改为字符格式或 int64。
谢谢你。