compare_apsim_soil_profile: Compare two or more soil profiles

View source: R/apsimx_soil_profile.R

compare_apsim_soil_profileR Documentation

Compare two or more soil profiles

Description

Helper function which allows for a simple comparison among soil_profile objects

print method for ‘soil_profile_mrg’

plotting function for compare_apsim_soil_profile, it requires ggplot2

Usage

compare_apsim_soil_profile(
  ...,
  soil.var = c("all", "Thickness", "BD", "AirDry", "LL15", "DUL", "SAT", "KS", "Carbon",
    "SoilCNRatio", "FOM", "FOM.CN", "FBiom", "FInert", "NO3N", "NH4N", "PH",
    "ParticleSizeClay", "ParticleSizeSilt", "ParticleSizeSand"),
  property,
  labels,
  merge.wide = TRUE,
  check = FALSE,
  verbose = FALSE
)

## S3 method for class 'soil_profile_mrg'
print(x, ..., format = c("wide", "long"), digits = 2)

## S3 method for class 'soil_profile_mrg'
plot(
  x,
  ...,
  plot.type = c("depth", "vs", "diff", "density"),
  pairs = NULL,
  soil.var = c("all", "Thickness", "BD", "AirDry", "LL15", "DUL", "SAT", "KS", "Carbon",
    "SoilCNRatio", "FOM", "FOM.CN", "FBiom", "FInert", "NO3N", "NH4N", "PH",
    "ParticleSizeClay", "ParticleSizeSilt", "ParticleSizeSand"),
  property,
  span = 0.75
)

Arguments

...

‘soil_profile’ objects. Should be of class ‘soil_profile’

soil.var

soil variable to plot

property

same as soil.var

labels

labels for plotting and identification of ‘soil_profile’ objects.

merge.wide

whether to attempt to merge soils in ‘wide’ format.

check

whether to check ‘soil_profile’ objects using ‘check_apsimx_soil_profile’.

verbose

whether to print agreement values (default is FALSE).

x

object of class ‘soil_profile_mrg’

format

either ‘wide’ or ‘long’, which depends on the merging.

digits

number of digits to print (default is 2)

plot.type

either ‘depth’, ‘vs’, ‘diff’ or ‘density’

pairs

pair of objects to compare, defaults to 1 and 2 but others are possible

span

argument to be passed to ‘geom_smooth’

Value

object of class ‘soil_profile_mrg’, which can be used for further plotting

a table with indexes for the soil profiles

it produces a plot

Note

I have only tested this for 2 or 3 objects. The code is set up to be able to compare more, but I'm not sure that would be all that useful.

Examples

## Not run: 
require(soilDB)
require(sp)
require(sf)
require(spData)
# Get two soil profiles
sp1 <- get_ssurgo_soil_profile(lonlat = c(-93, 42))
sp2 <- get_ssurgo_soil_profile(lonlat = c(-92, 41))
# Compare them
cmp <- compare_apsim_soil_profile(sp1[[1]], sp2[[1]], labels = c("sp1", "sp2"))
# Plot the variables
plot(cmp)

## End(Not run)


apsimx documentation built on April 3, 2025, 10:58 p.m.