generalize.hz: Generalize Horizon Names

Description Usage Arguments Value Author(s) References Examples

Description

Generalize a vector of horizon names, based on new classes, and REGEX patterns.

Usage

1
generalize.hz(x, new, pat, non.matching.code)

Arguments

x

a character vector of horizon names

new

a character vector of new horizon classes

pat

a character vector of REGEX, same length as x

non.matching.code

text used to describe any horizon not matching any item in pat

Value

factor of the same length as x

Author(s)

Dylan E. Beaudette

References

http://casoilresource.lawr.ucdavis.edu/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(sp1)

# check original distribution of hz designations
table(sp1$name)

# generalize
sp1$genhz <- generalize.hz(sp1$name, 
new=c('O','A','B','C','R'), 
pat=c('O', '^A','^B','C','R'))

# see how we did / what we missed
table(sp1$genhz, sp1$name)

Example output

This is aqp 1.17

Attaching package: 'aqp'

The following object is masked from 'package:base':

    union


  2C  2C1  2C2  3Ab 3Bwb   3C  3Cb    A   A1   A2   A3   AB  AB1  AB2  AB3   BA 
   2    2    2    1    2    2    1    4    4    4    1    5    1    1    1    2 
  Bt  Bt1  Bt2  Bw1  Bw2  Bw3    C   C1   C2 Oa/A   Oe   Oi   Rt 
   1    3    3    3    3    1    1    2    2    1    1    3    1 
          
           2C 2C1 2C2 3Ab 3Bwb 3C 3Cb A A1 A2 A3 AB AB1 AB2 AB3 BA Bt Bt1 Bt2
  O         0   0   0   0    0  0   0 0  0  0  0  0   0   0   0  0  0   0   0
  A         0   0   0   0    0  0   0 4  4  4  1  5   1   1   1  0  0   0   0
  B         0   0   0   0    0  0   0 0  0  0  0  0   0   0   0  2  1   3   3
  C         2   2   2   0    0  2   1 0  0  0  0  0   0   0   0  0  0   0   0
  R         0   0   0   0    0  0   0 0  0  0  0  0   0   0   0  0  0   0   0
  not-used  0   0   0   1    2  0   0 0  0  0  0  0   0   0   0  0  0   0   0
          
           Bw1 Bw2 Bw3 C C1 C2 Oa/A Oe Oi Rt
  O          0   0   0 0  0  0    1  1  3  0
  A          0   0   0 0  0  0    0  0  0  0
  B          3   3   1 0  0  0    0  0  0  0
  C          0   0   0 1  2  2    0  0  0  0
  R          0   0   0 0  0  0    0  0  0  1
  not-used   0   0   0 0  0  0    0  0  0  0

aqp documentation built on May 2, 2019, 4:51 p.m.