multinominal2logical {sharpshootR} | R Documentation |
Convert a single multinominal, site-level attribute from a SoilProfileCollection into a matrix of corresponding logical values. The result contains IDs from the SoilProfileCollection and can easily be joined to the original site-level data.
multinominal2logical(x, v)
x |
a |
v |
the name of a site-level attribute that is a factor with more than 2 levels |
A data.frame
with IDs in the first column, and as many columns of logical vectors as there were levels in v
. See examples.
D.E. Beaudette
## Not run:
##D # sample data, an SPC
##D data(loafercreek, package='soilDB')
##D
##D # convert to factor
##D loafercreek$hillslope_pos <- factor(loafercreek$hillslope_pos,
##D levels=c('Toeslope', 'Footslope', 'Backslope', 'Shoulder', 'Summit'))
##D
##D # convert to logical matrix
##D hp <- multinominal2logical(loafercreek, 'hillslope_pos')
##D
##D # join-in to site data
##D site(loafercreek) <- hp
##D
##D # variable names
##D v <- c('lithic.contact', 'paralithic.contact',
##D 'argillic.horizon', 'Toeslope', 'Footslope',
##D 'Backslope', 'Shoulder', 'Summit')
##D
##D # visualize with some other diagnostic features
##D x <- diagnosticPropertyPlot(loafercreek, v, k=5,
##D grid.label='bedrock_kind', dend.label='pedon_id')
## End(Not run)