hz_lag {aqp} | R Documentation |
Find lagged horizon values
Description
This function finds adjacent values to a horizon values at lagged distances.
Usage
hz_lag(
object,
lag = 1,
unit = "index",
idcol = "id",
depthcols = c("top", "bottom"),
order = FALSE
)
Arguments
object |
a |
lag |
integer: number of horizons to lag |
unit |
character: lag units in index or depth. |
idcol |
character: column name of the pedon ID within the object. |
depthcols |
a character vector of length 2 specifying the names of the horizon depths (e.g. |
order |
logical: indicating whether or not to order the #' |
Details
.
Value
A data.frame
with lagged values.
Author(s)
Stephen Roecker
See Also
hz_dissolve()
, hz_intersect()
, hz_segment()
Examples
h <- data.frame(
id = 1,
top = c(0, 25, 44, 46, 50),
bottom = c(25, 44, 46, 50, 100),
texcl = c("SL", "SL", "CL", "CL", "L"),
clay = c(10, 12, 27, 35, 16)
)
h |> hz_lag()
h |> hz_lag(-1)
h |> hz_lag(10:15, unit = "depth")
h |>
hz_lag() |>
cbind(h, lag = _) |>
transform(
clay_dif = lag.clay_bot.1 - clay,
texcl_contrast = paste0(texcl, "-", lag.texcl_bot.1))
[Package aqp version 2.0.4 Index]