I am currently working on a model that contains many categorical features. To cast them as factors, I need to call pivotalr_df$factor_column <- as.factor(pivotalr_df$factor_column) on 90 columns. Usually one would for example loop over an array of factors using the df[, factor_column] subsetting mechanism. If I try to call pivotalr_df[, factor_column] <- as.factor(pivotalr_df[, factor_column]) I get the following error: Error in is(i, "db.Rquery") (from <text>#1) : argument "i" is missing.
Is it possible to add an convenience function to transform a vector of column names to factors?
I am currently working on a model that contains many categorical features. To cast them as factors, I need to call
pivotalr_df$factor_column <- as.factor(pivotalr_df$factor_column)
on 90 columns. Usually one would for example loop over an array of factors using thedf[, factor_column]
subsetting mechanism. If I try to callpivotalr_df[, factor_column] <- as.factor(pivotalr_df[, factor_column])
I get the following error:Error in is(i, "db.Rquery") (from <text>#1) : argument "i" is missing
.Is it possible to add an convenience function to transform a vector of column names to factors?
Thanks and best