Summarizes how each group, for instance a subject, was sampled over time.

getSamplingSummary(x, ...)

# S4 method for class 'SummarizedExperiment'
getSamplingSummary(x, time.col, group = NULL, ...)

Arguments

x

A SummarizedExperiment object.

...

additional arguments. Currently not used.

time.col

Character scalar. Specifies a name of the column from colData that identifies the sampling time points for the samples.

group

NULL or Character scalar. Specifies a column from colData(x) that defines the groups. If NULL, all samples are summarized together. (Default: NULL)

Value

DataFrame with one row per group.

Details

Temporal metrics, such as stepwise divergence or stability, depend on how many time points each group has and how far apart they are. This function reports, for each group, the number of samples and distinct time points, the first and last time point, the time span, and the minimum, median and maximum gap between consecutive time points. Gaps are NA for groups with a single time point.

Examples

library(miaTime)

data(hitchip1006)
res <- getSamplingSummary(hitchip1006, time.col = "time", group = "subject")

# Number of subjects by the number of time points
table(res$n_time_points)
#> 
#>   1   2   3   4   5 
#> 928  40  23   1  14