nonzero: Proportions of Non-Zero Values (Prevalence)

View source: R/nonzero.R

nonzeroR Documentation

Proportions of Non-Zero Values (Prevalence)

Description

This function calculates the proportion of non-zero values (prevalence) for each response and plots the proportions.

Usage

nonzero(y, total, min.p=0, sort=TRUE, plot=FALSE)

Arguments

y

a matrix of responses; each column is a response and rows are samples.

total

optional. It is total number (total reads in microbiome data). If not provided, the number is calculated as the column sum of y.

min.p

a value in [0, 1). The responses with the proportion of non-zero values > min.p are returned.

sort

sort by the nonzero proportions of the responses into decreasing order.

plot

plot zero proportion and total number or not.

Value

Proportions of non-zero values (i.e. prevalence) for responses: nonzero.p, total numbers for all samples: total, mean and standard deviation of total numbers: total_mean_sd, filtered responses: y.filter, and plots of ordered proportions of zero values and total numbers.

Author(s)

Nengjun Yi, nyi@uab.edu

Examples


library(NBZIMM)

data(Romero)
names(Romero)
otu = Romero$OTU; dim(otu)
sam = Romero$SampleData; dim(sam)
colnames(sam)
N = sam[, "Total.Read.Counts"]  # total reads

non = nonzero(y=otu, total=N, plot=T)
names(non)


nyiuab/NBZIMM documentation built on April 21, 2022, 7 a.m.