rsp.reshape | R Documentation |
Functions for reshaping respeciate profiles
rsp_dcast
and rsp_melt_wide
reshape supplied
respeciate profile(s). rsp_dcast
converts these from their supplied
long form to a widened form, dcast
ing the data set by either species
or profiles depending on the widen
setting applied.
rsp_dcast_profile
, rsp_dcast_profile_id
,
rsp_dcast_species
and rsp_dcast_species_id
are wrappers for
these options. rsp_melt_wide
attempts to return a previously widened data
set to the original long form.
rsp_dcast(rsp, widen = "species")
rsp_dcast_profile(rsp, widen = "profile")
rsp_dcast_profile_id(rsp, widen = "profile.id")
rsp_dcast_species(rsp = rsp, widen = "species")
rsp_dcast_species_id(rsp = rsp, widen = "species.id")
rsp_melt_wide(rsp, pad = FALSE, drop.nas = FALSE)
rsp |
A |
widen |
character, when widening |
pad |
logical or character, when |
drop.nas |
logical, when |
rsp_dcast
returns the wide form of the supplied
respeciate
profile. rsp_melt_wide
returns the (standard) long form of a previously widened profile.
Conventional long-to-wide reshaping of data, or dcast
ing, can
be slow and memory inefficient. So, respeciate
uses the
data.table::dcast
method. The rsp_dcast_species
method,
applied using widen='species'
, is effectively:
dcast(..., profile.id+.profile~.species, value.var=".value")
And, the alternative widen='profile'
:
dcast(..., species.id+.species~.profile, value.var=".value")
respeciate
uses a local version of the SPECIATE
and
SPECIEUROPE
weight measurements .value
, so the EPA and
JCR source information can easily be recovered. See also
rsp_rescale_profile
.
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>.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.