multinominal2logical {sharpshootR}R Documentation

Convert multinominal to logical matrix

Description

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.

Usage

multinominal2logical(x, v)

Arguments

x

a SoilProfileCollection object

v

the name of a site-level attribute that is a factor with more than 2 levels

Value

A data.frame with IDs in the first column, and as many columns of logical vectors as there were levels in v. See examples.

Author(s)

D.E. Beaudette

See Also

diagnosticPropertyPlot

Examples

## 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)

[Package sharpshootR version 0.8-4 Index]