Last chance! 50% off unlimited learning
Sale ends in
Convert values of a categorical cover scale to percentage values.
This function requires as input a coverconvert object which contains the conversion tables.
In the case of vegtable objects, the conversion is already embedded
in the slot coverconvert
.
Three rules are implemented for transformation, either top
(values
transformed to the top of the range), middle
(transformation at the
midpoint), and bottom
(conversion at the lowest value of the
range). In the later case, transformation ranges starting at 0% of cover
can be set to a different value by the argument zeroto
.
When replace=FALSE
, existing values of cover in the vegtable
object will be maintained. Since there is not a standard naming of cover
values, in the transformation the name of cover variable should be
indicated in the argument to
.
# S4 method for character,coverconvert
cover_trans(x, conversion, from = NULL, rule = "top", zeroto = 0.1, ...)# S4 method for factor,coverconvert
cover_trans(x, conversion, ...)
# S4 method for numeric,coverconvert
cover_trans(x, conversion, ...)
# S4 method for vegtable,missing
cover_trans(x, to, replace = FALSE, rule = "top", zeroto = 0.1, ...)
Either a vector or a vegtable object.
Either a factor or character vector, or a vegtable object.
An object of class vegtable.
Scale name of values in x
as character value.
Rule applied for the conversion (see details).
Value used to replace levels with bottom at 0% cover.
Further arguments passed from or to other methods.
Name of the column in slot samples
for writing converted values.
Logical value indicating whether existing cover values should be replaced or not.
Miguel Alvarez kamapu78@gmail.com
## Check the available scales
summary(Kenya_veg@coverconvert)
## Conversion by default 'top' rule
Kenya_veg <- cover_trans(Kenya_veg, to="percent")
summary(as.factor(Kenya_veg@samples$percent))
## Conversion by 'middle' rule
Kenya_veg <- cover_trans(Kenya_veg, to="percent", rule="middle", replace=TRUE)
summary(as.factor(Kenya_veg@samples$percent))
## Conversion by 'bottom' rule
Kenya_veg <- cover_trans(Kenya_veg, to="percent", rule="bottom", replace=TRUE)
summary(as.factor(Kenya_veg@samples$percent))
Run the code above in your browser using DataLab