Skip to contents

A central S3 class that defines a data.frame where columns given in id_cols define distinct soil profiles.

Usage

cfp_profile(x, id_cols = NULL)

Arguments

x

A data.frame

id_cols

Column names in data.frame that uniquely identify each profile.

Value

A cfp_profile object. This is a data.frame with the id_cols attribute.

See also

Examples

df <- data.frame(
  site = rep(c("site_a", "site_b"), each = 2),
  variable = 1:4)

cfp_profile(df, id_cols = "site")
#> 
#> A cfp_profile object 
#> id_cols: site 
#> 2  unique profiles 
#> 
#>     site variable
#> 1 site_a        1
#> 2 site_a        2
#> 3 site_b        3
#> 4 site_b        4

### multiple id_cols
df <- data.frame(
  site = rep(c("site_a", "site_b"), each = 4),
  replicate = rep(c(1,2), times = 4),
  variable = 1:8)

cfp_profile(df, id_cols = c("site", "replicate"))
#> 
#> A cfp_profile object 
#> id_cols: site replicate 
#> 4  unique profiles 
#> 
#>     site replicate variable
#> 1 site_a         1        1
#> 2 site_a         2        2
#> 3 site_a         1        3
#> 4 site_a         2        4
#> 5 site_b         1        5
#> 6 site_b         2        6
#> 7 site_b         1        7
#> 8 site_b         2        8