View source: R/base_package_functions.R View source: R/Package-Code5-Compiled.R
subsetSamples | R Documentation |
Quick function to subset samples/observations from a data matrix based on an annotation or characteristic. Can also pull out samples/observations by name with the option to order the rows by expression of a given sample.
subsetSamples(data, group, take.out, list, order.by = NULL, exact = F,
subset.by = "annotation")
data |
numeric data matrix with samples/observations in the columns and genes/variables in the rows |
group |
character string pointing to a column name in the annotations stored in params. Can also supply a custom vector the same length as the columns of the input matrix. |
take.out |
level or levels of the group vector supplied indicating the samples to be extracted |
list |
character vector of samples/observations to be pulled out of the data matrix for viewing |
order.by |
optional string equal to one of the colnames of the supplied data frame. Rows of output data matrix will be ordered according to the supplied sample from lowest to highest expression value. |
exact |
whether or not to search for exact or inexact matches of 'list' in 'data'. If exact = T (default) output will contain samples/observations that exactly match the list supplied. If set to FALSE, will search for inexact matches. |
subset.by |
whether to subset by an annotation stored in params$annotations ("annotation", default) or by the a list of names to search for in column names ("name") |
data matrix with the same number of rows as the input data matrix but subset for the specified samples
~~Alison Moss~~
##initiate parameters and set up annotations
initiate_params()
set_annotations(RAGP_annots)
##subset samples for SAN-Projecting cells
SAN.proj <- subsetSamples(RAGP_norm, group = "Connectivity", take.out = "SAN-Projecting")
##subset samples for cells with projection information
proj.ino <- subsetSamples(RAGP_norm, group = "Connectivity",
take.out = c("SAN-Projecting", "Non-SAN-Projecting"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.