I have to read the data file in feather format with predefined set of columns. It generates an error if the column does not exists in the data file. How to check it "before" reading data set
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"))
}
Thanks!