View source: R/change_composition.R
change_composition | R Documentation |
This makes a change to a composition in the specified way and automatically reallocates to/from other parts of the composition proportionally. It primarily exists as a utility function to make reporting easier.
change_composition( composition, main_part, at_expense_of = NULL, main_change, comp_labels )
composition |
This should be the starting composition as a data frame. |
main_part |
part the main change is happening to. |
at_expense_of |
Parts the main change is at the expense of/ reallocated to. |
main_change |
Magnitude and direction of change e.g. +1, -0.5. |
comp_labels |
Compositional column labels. |
Composition after reallocating as described.
new_comp <- change_composition( composition = simdata[1,], main_part = "moderate", main_change = +0.5, comp_labels = c("vigorous", "moderate", "light", "sedentary", "sleep") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.