anyMissingLevels: A function to determine whether any level of a categorical...

View source: R/anyMissingLevels.R

anyMissingLevelsR Documentation

A function to determine whether any level of a categorical variable has completely missing outcome (metabolite) data

Description

This function determines whether any level of a categorical predictor variable has completely missing outcome data.

Usage

anyMissingLevels( yname,  cat.vars,  dataset)

Arguments

yname

A character string indicating the outcome variable, i.e., a metabolite.

cat.vars

A character vector of categorical variable names.

dataset

A data frame containing the yname and cat.vars variables.

Value

Returns a list indicating whether each of the variables specified in argument cat.vars has at least one level with completely missing values for the outcome variable specified in yname.

Author(s)

Michael Nodzenski

Examples


#create example analysis data 
data(euMetabCData)
example.data<-euMetabCData
example.data[example.data$batch==1, "aspartic_acid"]<-NA

#check to determine if aspartic acid values are entirely missing for 
#any level of batch or pheno 
anyMissingLevels( "aspartic_acid", c( "batch",  "pheno"), example.data)



mnodzenski/metabomxtr documentation built on Aug. 24, 2022, 1:40 p.m.