Learn R Programming

quest (version 0.2.0)

nrow_ml: Multilevel Number of Rows

Description

nrow_ml computes the number rows in the data as well as the number of groups in the data. This corresponds to the within-group sample size and between-group sample size (ignoring any missing data). This is simply a combination of nrow + ngrp.

Usage

nrow_ml(data, grp.nm)

Value

list with two elements providing the sample sizes (ignoring missing data). The first element is named "within" and contains the number of rows in the data. The second element is named "between" and contains the number of groups in the data.

Arguments

data

data.frame of data.

grp.nm

character vector of colnames from data specifying the grouping variables.

See Also

ncases_ml nrow_by ncases_by ngrp

Examples

Run this code

# one grouping variable
nrow_ml(data = as.data.frame(ChickWeight), grp.nm = "Chick")

# multiple grouping variables
nrow_ml(data = mtcars, grp.nm = c("vs","am"))

Run the code above in your browser using DataLab