do.aggregate: Aggregate data using data.table functions - summarises the...

Description Usage Arguments Value Examples

View source: R/do.aggregate.R

Description

Aggregate data using data.table functions – summarises the mean, median, or sum expression of each marker on each cluster/population

Usage

1
do.aggregate(dat, use.cols, by, func, dt)

Arguments

dat

NO DEFAULT. A data.table (or data.frame) containing the data to be aggregated.

use.cols

NO DEFAULT. The columns to be used for aggregation.

by

NO DEFAULT. The column that contains the cluster/population identities.

func

DEFAULT = 'median'. Character, method of aggregation. Can be 'median', 'mean', or 'sum'.

dt

DEFAULT = TRUE. If TRUE returns data.table with observations and the use.cols, if false returns data.frame with use.cols, and rownames as the observations

Value

Returns a new data.table with values of use.cols aggregated per cluster/population.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
exp <- do.aggregate(dat = Spectre::demo.clustered,
                    use.cols = names(demo.clustered)[c(11:19)],
                    by = "Population")

# Typically followed up by making an expression heatmap
Spectre::make.pheatmap(dat = exp,
                       file.name = "Pheatmap.png",
                       plot.title = "Pheatmap",
                       sample.col = "Population",
                       plot.cols = names(exp)[c(2:10)])

sydneycytometry/Spectre documentation built on March 20, 2021, 2:15 a.m.