View source: R/create.sumtable.R
create.sumtable | R Documentation |
This function summarises cellular data and generates a summary data.table
create.sumtable(dat, sample.col, pop.col, use.cols, annot.cols, counts, func, sep)
dat |
NO DEFAULT. A data.table containing cells (rows) vs features/markers (columns). One column must represent sample names, and another must represent populations/clusters. |
sample.col |
NO DEFAULT. Character. Name of the sample column (e.g. "Sample"). |
pop.col |
NO DEFAULT. Character. Name of the population/cluster column (e.g. "Population", "Cluster"). |
use.cols |
DEFAULT = NULL A character vector indicating the columns to be measured (e.g. cellular columns – c("CD45", "CD3e") etc). |
annot.cols |
DEFAULT = NULL. A character vector indicating the columns to be included as annotation columns (e.g. c("Batch", "Group") etc). |
parent.col |
DEFAULT = NULL. A character entry indicating a column that represents the 'lineage' each population belongs to (e.g. 'CD4 T cells' may belong to the 'T cells' lineage). Use this to also calculate each population as a percentage of lineage. |
counts |
DEFAULT = NULL. If you wish to calculate the actual number of cells per sample, a data.frame or data.table containing the sample names (in column 1) and cell counts per sample (column 2). |
perc.pos |
DEFAULT = NULL. If you wish to calculate the percentage of each population that is 'positive' for a marker, you can provide a data.table containing the mark names (in column 1) and cut off values for positivity (column 2). |
double.pos |
DEDAULT = NULL. List of vectors, each vector containing the names of multiple markers you wish to calculate % positive for (e.g. CD38+HLADR+). Generates 'and' and 'or' combinations. |
func |
DEFAULT = "median". Can be "median" or "mean". Defines the type of function for calculating MFI data. |
sep |
DEFAULT = " – ". Character separation of the measurement type and the population (e.g. MFI of CD4 – T cells) |
Thomas M Ashhurst, thomas.ashhurst@sydney.edu.au
https://github.com/ImmuneDynamics/Spectre.
## Calculate and export results from demonstration data
dat <- Spectre::demo.clustered
counts <- data.frame('Sample' = unique(dat[['Sample']]),
'Counts' = c(rep(100000, 6), rep(1000000, 6)))
sum.dat <- create.sumtable(dat = dat,
sample.col = "Sample",
pop.col = "Population",
use.cols = names(dat)[c(11:19)],
counts = counts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.