diff --git a/R/sortObservations.R b/R/sortObservations.R index 2f2781a..7b57990 100644 --- a/R/sortObservations.R +++ b/R/sortObservations.R @@ -5,7 +5,7 @@ #' @importFrom dplyr arrange #' @description Since the GEE & GLMM modes require data to be sorted by sample ID and pseudotime, this function provides a simple way to do so for a range of inputs. #' @param expr.mat Either a \code{SingleCellExperiment} or \code{Seurat} object from which counts can be extracted, or a matrix of integer-valued counts with genes as rows & cells as columns. Defaults to NULL. -#' @param pt A vector of pseudotime values used to sort the observations. May contain NA values. Defaults to NULL. +#' @param pt.vec A vector of pseudotime values used to sort the observations. May contain NA values. Defaults to NULL. #' @param id.vec A vector of subject IDs used to sort the observations. Defaults to NULL. #' @return An object of the same class as the input \code{expr.mat}, but sorted by sample ID & pseudotime. #' @details @@ -21,14 +21,14 @@ #' id.vec = sim_counts$subject) sortObservations <- function(expr.mat = NULL, - pt = NULL, + pt.vec = NULL, id.vec = NULL) { # check inputs if (is.null(expr.mat) || is.null(pt) || is.null(id.vec)) { stop("You forgot some inputs to sortObservations().") } if (any(is.na(id.vec))) { stop("The subject ID vector must not contain any NA values.") } # create table with subject ID and pseudotime subj_df <- data.frame(ID = id.vec, - PT = pt, + PT = pt.vec, Cell = colnames(expr.mat)) # arrange by subject ID then pseudotime subj_df <- dplyr::arrange(subj_df, diff --git a/man/sortObservations.Rd b/man/sortObservations.Rd index 88a028b..8915e45 100644 --- a/man/sortObservations.Rd +++ b/man/sortObservations.Rd @@ -4,12 +4,12 @@ \alias{sortObservations} \title{Sort observations by sample ID and pseudotime.} \usage{ -sortObservations(expr.mat = NULL, pt = NULL, id.vec = NULL) +sortObservations(expr.mat = NULL, pt.vec = NULL, id.vec = NULL) } \arguments{ \item{expr.mat}{Either a \code{SingleCellExperiment} or \code{Seurat} object from which counts can be extracted, or a matrix of integer-valued counts with genes as rows & cells as columns. Defaults to NULL.} -\item{pt}{A vector of pseudotime values used to sort the observations. May contain NA values. Defaults to NULL.} +\item{pt.vec}{A vector of pseudotime values used to sort the observations. May contain NA values. Defaults to NULL.} \item{id.vec}{A vector of subject IDs used to sort the observations. Defaults to NULL.} }