Description Usage Arguments Value Examples
View source: R/derive_metric.R
Permits the use of arithmetic or other R functions for each metric. Can accept other metrics in arguments.
1 | derive_metric(.df, .name, .formula)
|
.df |
A data frame containing tidycyte data. |
.name |
< |
.formula |
< |
An updated data frame containing the new or revised metric.
1 2 3 4 5 | df %>% derive_metric(Yellow, sqrt(`h2-3`) / mAzalea^2 - 3) # mathematical operations and offsets
df %>% derive_metric(mAzalea, mAzalea - mean(mAzalea)) # can use other functions
df %>% derive_metric(mAzalea, mAzalea - as.numeric(quantile(mAzalea,0.05))) # minus bottom 5%ile
df %>% derive_metric(mAzalea_scaled, mAzalea) %>% # copy to new name rather than the original name
scale_metric(mAzalea_scaled) # rescale from 0 to 1 by default, returns the same name
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.