我必须使用预定义的列集以羽毛格式读取数据文件。如果数据文件中不存在该列,则会生成错误。如何“在”读取数据集之前检查它
library(feather)
# 1. Data set
df_mtcars <- mtcars
# 2. Drop column
df_mtcars$mpg <- NULL
# 3. Save data
write_feather(df_mtcars, "df_mtcars")
# 4. How check column existance in file 'before' reading
if(!is.null(...)) {
read_feather("df_mtcars", columns = c("mpg"))
}
谢谢!