Description Usage Arguments Details Value Examples
Will take a data.frame and apply a function ('fun') to 'value' within the groups defined by the 'id' column.
1 | meth_aggregate(data, id, value, fun = mean, ...)
|
data |
a data.frame. |
id |
variable name, to be aggregated around. |
value |
variable name, contains the value to take mean over. Must be a single column. |
fun |
function, summary statistic function to be calculated. Defaults to 'mean'. |
... |
Additional arguments for the function given to the argument fun. |
Please note the ordering of the data will matter depending on the choice of aggregation function.
A methcon object. Contains the aggregated data along with original data.frame and variable selections.
1 2 3 4 5 6 7 8 9 10 | meth_aggregate(fake_methylation, id = gene, value = meth, fun = mean)
meth_aggregate(fake_methylation, id = gene, value = meth, fun = var)
# custom functions can be used as well
mean_diff <- function(x) {
mean(diff(x))
}
meth_aggregate(fake_methylation, id = gene, value = meth, fun = mean_diff)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.