Displaying 1 result from an estimated 1 matches for "final_purchase_amount".
2012 Aug 07
2
Re-grouping data in R
I have a data frame with a column of values that I want to bucket (group)
into specific levels.
> str(dat)'data.frame': 3678 obs. of 39 variables:
$ id : int 23 76 129 156 166 180 200 214 296 344 ...
$ final_purchase_amount : Factor w/ 32 levels
"\\N","1082","1109",..: 1 1 1 1 1 1 1 1 1 1 ...
So I ran the following to produce new levels, one for values from 100
to 400, 401 to 1000, and 1001+.
dat$final_purchase_amount<- NA
dat$final_purchase_amount[dat$final_purchase_amount %...