Functions for rescaling respeciate data sets

rsp_rescale rescales the percentage weight records in a supplied respeciate profile data set. This can be by profile or species subsets, and rsp_rescale_profile and rsp_rescale_species provide short-cuts to these options.

rsp_rescale(rsp, method = 2, by = "species")

rsp_rescale_profile(rsp, method = 1, by = "profile")

rsp_rescale_species(rsp, method = 2, by = "species")

Arguments

rsp

A respeciate object, a data.frame of respeciate profiles.

method

numeric, the rescaling method to apply: 1 x/total(x); 2 x/mean(x); 3 x-min(x)/max(x)-min(x); 4 x-mean(x)/sd(x); 5 x/max(x). The alternative 0 returns the records to their original values.

by

character, when rescaling x with rsp_rescale, the data type to group and rescale, currently 'species' (default) or 'profile'.

Value

rsp_rescale and rsp_rescale return the respeciate profile with the percentage weight records rescaled using the requested method. See Note.

Note

Data sometimes needs to be normalised, e.g. when applying some statistical analyses. Rather than modify source information in SPECIATE and SPECIEUROPE, respeciate creates a duplicate column .value which is modified by operations like sp_rescale_profile and sp_rescale_species. This means rescaling is always applied to the source information, rather than rescaling an already rescaled value, and the EPA records are retained unaffected. So, the original source information can be easily recovered.

References

Dowle M, Srinivasan A (2023). data.table: Extension of `data.frame`. R package version 1.14.8, https://CRAN.R-project.org/package=data.table.