Displaying 1 result from an estimated 1 matches for "cutresultsdf".
2009 Sep 13
1
Manage an unknown and variable number of data frames
...ching 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't
# get managed automatically.
Subset1 = subset(subset(dat, aRange==CutTable$a[1]), bRange==CutTable$b[1])[1:2]
Subse...