library_weighted_mean | R Documentation |
This function calculates the weighted mean of the measures provided, given the weights provided. Should be provided the measures for one Sample_Name/Poseidon_ID at a time. Unlike stats::weighted.mean, this function first filters for distinct rows, to avoid counting duplicated results as independent observations.
library_weighted_mean(lib_ids, measure, weight, na.rm = T)
lib_ids |
character. The names of the libraries the measures correspond to. |
measure |
character. The measures to get a weighted mean for |
weight |
character. The weight of each measure. |
na.rm |
logical. Should NAs be removed from the weighted mean. passed on to stats::weighted.mean(na.rm) |
character. The weighted mean of the unique library-level measures.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.