| prepare_swrc_data | R Documentation |
A convenience wrapper that:
Renames columns to standard names.
Parses the depth column.
Fixes bulk-density units.
Detects and normalises volumetric water content units.
Computes per-profile maximum theta.
Drops rows with missing key variables.
prepare_swrc_data(
df,
x_cols = NULL,
depth_col = "depth",
fix_bd = TRUE,
fix_theta = TRUE
)
df |
A data frame with soil characterization data. |
x_cols |
Named character vector mapping standard names to
actual column names. Standard names: |
depth_col |
Column name for depth (character string, default
|
fix_bd |
Logical; apply |
fix_theta |
Logical; scale theta to m3/m3 if needed (default
|
A tibble with standardised columns plus Depth_num,
Depth_label, bd_gcm3, theta_n (normalised WC), and
theta_max_n (per-profile maximum theta).
df <- data.frame(
ID = rep("P01", 3),
sand_pct = c(50, 50, 50),
silt = c(30, 30, 30),
clay = c(20, 20, 20),
soc = c(1.2, 1.2, 1.2),
bd_gcc = c(1.3, 1.3, 1.3),
matric_head = c(10, 100, 1000),
theta = c(0.40, 0.30, 0.20),
depth = c("0-30", "0-30", "0-30")
)
df_prep <- prepare_swrc_data(df,
x_cols = c(PEDON_ID = "ID", sand = "sand_pct", bd = "bd_gcc",
water_content = "theta"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.