If soil is a tibble() without the soil$rootden column, run_LWFB90() returns a warning.
This is because tibble() is stricter with missing columns than data.frame() and warns if you want to select $ a missing column. chk_soil() tries to call soil$rootden, leading to this warning.
Since many people probably use dplyr to create the soil data.frame(), it could be a good idea to handle this case to prevent some confusion. One possibility could be to coerce to a data.frame(). #6bada7230c3c11fcb4195879c0ce94c063db8c14
reprex of problem:
library(LWFBrook90R)
library(tibble)
#> Warning: package 'tibble' was built under R version 4.4.3
# Set up lists containing model control options and model parameters:
param_b90 <- set_paramLWFB90()
options_b90 <- set_optionsLWFB90()
# Set start and end Dates for the simulation
options_b90$startdate <- as.Date("2003-06-01")
options_b90$enddate <- as.Date("2003-06-30")
# Derive soil hydraulic properties from soil physical properties
# using pedotransfer functions
soil <- cbind(slb1_soil, hydpar_wessolek_tab(slb1_soil$texture))
soil <- tibble::as_tibble(soil)
# Run LWF-Brook90
b90.result <- run_LWFB90(options_b90 = options_b90,
param_b90 = param_b90,
climate = slb1_meteo,
soil = soil)
#> Warning: Unknown or uninitialised column: `rootden`.
Created on 2025-05-15 with reprex v2.1.1
If
soilis atibble()without thesoil$rootdencolumn,run_LWFB90()returns a warning.This is because
tibble()is stricter with missing columns thandata.frame()and warns if you want to select$a missing column.chk_soil()tries to callsoil$rootden, leading to this warning.Since many people probably use
dplyrto create thesoildata.frame(), it could be a good idea to handle this case to prevent some confusion. One possibility could be to coerce to adata.frame(). #6bada7230c3c11fcb4195879c0ce94c063db8c14reprex of problem:
Created on 2025-05-15 with reprex v2.1.1