multinominal2logical: Convert multinominal to logical matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/multinominal2logical.R

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

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
# sample data, an SPC
data(loafercreek, package='soilDB')

# convert to factor
loafercreek$hillslope_pos <- factor(loafercreek$hillslope_pos, 
levels=c('Toeslope', 'Footslope', 'Backslope', 'Shoulder', 'Summit'))

# convert to logical matrix
hp <- multinominal2logical(loafercreek, 'hillslope_pos')

# 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='bedrock_kind', dend.label='pedon_id')

## End(Not run)

sharpshootR documentation built on May 2, 2019, 4:46 p.m.