nafracCalc: Calculate fractions of missing values.

View source: R/nafracCalc.R

nafracCalcR Documentation

Calculate fractions of missing values.

Description

Calculate the fraction (univariate case) or fractions (bivariate case) of missing values in the data or in each component of the data.

Usage

nafracCalc(y,drop=TRUE)

Arguments

y

A vector or a one or two column matrix of discrete data or a list of such vectors or matrices, or a list of such lists (an object of class "multipleHmmDataSets" such as might be produced by rhmm()).

drop

Logical scalar. If y is of class "multipleHmmDataSets" but actually consists of a single data set, and if drop is TRUE, then the returned value is not a list but rather the single component that such a list “would have had” were drop equal to FALSE. This argument is ignored if y is not of class "multipleHmmDataSets" or has length greater than 1.

Value

If y is not of class "multipleHmmDataSets", then the returned value is a scalar (between 0 and 1) if the data are univariate or a pair (2-vector) of such scalars if the data are bivariate. The values are equal to the ratios of the total count of missing values in the appropriate column to the total number of observations.

If y is of class "multipleHmmDataSets", and if y has length greater than 1 or drop is FALSE, then the returned value is a list of such scalars or 2-vectors, each corresponding to one of the data sets constituting y. If y has length equal to 1 and drop is TRUE, then the returned value is the same as if codey were not of class "multipleHmmDataSets".

Author(s)

Rolf Turner r.turner@auckland.ac.nz

See Also

rhmm() misstify()

Examples

xxx <- with(SydColDisc,split(y,f=list(locn,depth)))
nafracCalc(xxx) # 0.7185199

hmm.discnp documentation built on Sept. 26, 2022, 5:05 p.m.