mutate_profile() is a function used for transforming SoilProfileCollections. Each expression is applied to site or horizon level attributes of individual profiles. This distinguishes this function from mutate, which is applied to all values in a collection, regardless of which profile they came from.

mutate_profile(object, ..., horizon_level = NULL)

Arguments

object

A SoilProfileCollection

...

A set of comma-delimited R expressions that resolve to a transformation to be applied to a single profile e.g mutate_profile(hzdept = max(hzdept) - hzdept)

horizon_level

logical. If TRUE results of expressions are added to the SoilProfileCollection's horizon slot, if FALSE the results are added to the site slot. If NULL (default) the results are stored in the site or horizon slot based on the number of rows in each slot compared to the length of the result calculated from the first and last profile in the collection.

Value

A SoilProfileCollection.

Details

If the length an expression's result matches the number of horizons, the result is stored as a horizon-level variable. If the result has length 1, it is stored as a site-level variable. In the ambiguous case where the first and last profile have only one horizon, the results are stored in the horizon slot by default. To force results into site slot use horizon_level = FALSE.

Author

Andrew G. Brown.