sampleNpc: Sample N % of a dataframe (obj@metadata), and return rownames...

View source: R/Seurat.Utils.Metadata.R

sampleNpcR Documentation

Sample N % of a dataframe (obj@metadata), and return rownames (cell IDs).

Description

This function samples a specified percentage of a dataframe (specifically a subset of the metadata of a Seurat object) and returns the corresponding cell IDs.

Usage

sampleNpc(metaDF = MetaData[which(Pass), ], pc = 0.1)

Arguments

metaDF

A dataframe representing a subset of the metadata of a Seurat object. Default: Subset of 'MetaData' for which 'Pass' is TRUE.

pc

The percentage of the dataframe to sample, expressed as a decimal. Default: 0.1.

Value

A vector of sampled cell IDs.

Examples

## Not run: 
if (interactive()) {
  # Example usage:
  # Suppose 'MetaData' is a dataframe and 'Pass' is a boolean vector with the same length.
  # The following example will sample 10% of the rows of 'MetaData' where 'Pass' is TRUE.
  sampleNpc(metaDF = MetaData[which(Pass), ], pc = 0.1)
}

## End(Not run)

vertesy/Seurat.utils documentation built on Dec. 4, 2024, 5:20 p.m.