greenplum-db / PivotalR-archive

An convenient R tool for manipulating tables in PostgreSQL type databases and a wrapper of Apache MADlib.
https://pivotalsoftware.github.io/gp-r/
125 stars 53 forks source link

Creating many factors with as.factor #26

Closed ronert closed 10 years ago

ronert commented 10 years ago

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?

Thanks and best

walkingsparrow commented 10 years ago

Bug fixed in master. Thank you for reporting this.

Maybe add a convenience function later.

ronert commented 10 years ago

Thanks for the quick bug fix!