whatsMax: Find maximum column for each row

Description Usage Arguments Value Author(s) Examples

Description

For each row, the function identifies the column that has the maximum value. The function returns a data frame with two columns: the first is the column name corresponding to the column of maximum value and the second is the correspond maximum. The first column is convereted to a factor.

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.

Usage

1
whatsMax(x,nbig=30)

Arguments

x

a data frame or matrix of numeric values.

nbig

see description–the maximum number of factors, the remainder called 'other'.

Value

A data frame.

Author(s)

Nicholas L. Crookston [email protected]
Andrew O. Finley [email protected]

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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])

yaImpute documentation built on May 2, 2019, 4:44 p.m.