If the maximum is zero, the maximum column is identified as "zero".
If there are over nbig
factors in column 1, the maximum values
that are less than the largest are combined and identified as "other".
Intended use is to transform community ecology data for use in yai
where method is randomForest.
whatsMax(x,nbig=30)
data(MoscowMtStJoe)
# get the basal area by species columns
yba <- MoscowMtStJoe[,1:17]
# for each row, pick the species that has the max basal area
# create "other" for those not in the top 7.
ybaB <- whatsMax(yba,nbig=7)
levels(ybaB[,1])
Run the code above in your browser using DataLab