Displaying 1 result from an estimated 1 matches for "cutresults".
Did you mean:
cutresultsdf
2009 Sep 13
1
Manage an unknown and variable number of data frames
...dat = data.frame(
a=round(runif(100,-20,30),2),
b=round(runif(100,-40,50),2)
)
# Give each cut list a name matching the column in dat that you
# want to use as criteria for making the cut.
# Create any number of cuts in each row.
CutList = list(
a=c(-Inf,-10,10,Inf),
b=c(-Inf,0,20,Inf)
)
CutResults = mapply(cut,x=dat[,names(CutList)],CutList,SIMPLIFY=FALSE)
CutTable = as.data.frame(table(CutResults))
CutResultsDF = as.data.frame(CutResults)
head(CutResultsDF, n=15)
dat$aRange = CutResultsDF$a
dat$bRange = CutResultsDF$b
head(dat, 15)
# I don't want to do the following as it doesn'...