Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rowTables

Rowwise Tables


Description

Computes a one-dimensional table for each row of a matrix that summarizes the values of the categorical variables represented by the rows of the matrix.

Usage

rowTables(x, levels = 1:3, affy = FALSE, includeNA = FALSE,
   useNN = c("not", "only", "also"), check = TRUE)

Arguments

x

a matrix in which each row represents a categorical variable (e.g., a SNP) and each column an observation, where the variables are assumed to show the levels specified by levels. Missing values are allowed in x.

levels

vector specifying the levels that the categorical variables in x show. Ignored if affy = TRUE.

affy

logical specifying whether the SNPs in x are coded in the Affymetrix standard way. If TRUE, levels = c("AA", "AB", "BB") and useNN = "also" will be used (the latter only when includeNA = TRUE).

includeNA

should a column be added to the output matrix containing the number of missing values for each variable?

useNN

character specifying whether missing values can also be coded by "NN". If useNN = "not" (default), missing values are assumed to be coded only by NA. If "only", then missing values are assumed to be coded only by "NN" (and not by NA. If "both", both "NN" and NA are considered. Ignored if affy = TRUE.

check

should it be checked whether some of the variables show other levels than the one specified by levels?

Value

A matrix with the same number of rows as x containing for each variable the numbers of observations showing the levels specified by levels.

Author(s)

Holger Schwender, holger.schwender@udo.edu

See Also

Examples

## Not run: 
# Generate a matrix containing data for 10 categorical
# variables with levels 1, 2, 3.

mat <- matrix(sample(3, 500, TRUE), 10)

rowTables(mat)


## End(Not run)

scrime

Analysis of High-Dimensional Categorical Data Such as SNP Data

v1.3.5
GPL-2
Authors
Holger Schwender, with a contribution of Arno Fritsch
Initial release
2018-12-01

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.