search for: cutquintiles

Displaying 1 result from an estimated 1 matches for "cutquintiles".

2013 Jan 08
2
Applying a user-defined function
...y goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message. > #now Write a new function using the above cut ()/quantile function to apply on different columns of the data frame > > CutQuintiles <- function(x) { + cut (test1$x,quantile (test1$x, (0:5/5)),include.lowest=TRUE) + } > > #apply the CutQuintile () on every odd-numbered columns of the "test1" data frame > newcols <- sapply(test1 [, seq (1,6,2)], CutQuintiles) Error in cut.default(test1$x, quantile(test1...