multinominal2logical: Convert Multinominal to Logical Matrix

View source: R/multinominal2logical.R

multinominal2logicalR 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, or can be coerced to 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




if(require(soilDB) &
   require(aqp) &
   require(latticeExtra)) {
  
  
  # sample data, an SPC
  data(loafercreek, package='soilDB')
  
  # convert to logical matrix
  hp <- multinominal2logical(loafercreek, 'hillslopeprof')
  
  # join-in to site data
  site(loafercreek) <- hp
  
  # variable names
  v <- c('lithic.contact', 'paralithic.contact', 
         'argillic.horizon', 'toeslope', 'footslope', 
         'backslope', 'shoulder', 'summit')
  
  # visualize with some other diagnostic features
  x <- diagnosticPropertyPlot(loafercreek, v, k = 5, 
                              grid.label = 'bedrckkind', dend.label = 'pedon_id')  
}




sharpshootR documentation built on Oct. 23, 2024, 1:06 a.m.