allMissingLevels: A function to determine whether metabolite levels are present...

View source: R/allMissingLevels.R

allMissingLevelsR Documentation

A function to determine whether metabolite levels are present for at most one level of a categorical variable.

Description

This function determines metabolite data are present for at most one level of a categorical predictor variable, and thus whether that predictor needs to be removed from the mixture model.

Usage

allMissingLevels(missing.levels.list, dataset)

Arguments

missing.levels.list

A list output by function idMissingLevels indicating which categorical variables have no corresponding metabolite data for at least one level.

dataset

A data frame containing the variables specified in missing.levels.list.

Value

Returns a list indicating whether categorical variables in missing.levels.list have metabolite data present for at most one level.

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 
missing.levels.check<-lapply( "aspartic_acid", anyMissingLevels, cat.vars=c("pheno", "batch"), dataset=example.data)
names(missing.levels.check)<-"aspartic_acid"
missing.levels.check

#find the specific missing level
missing.level.ids<-idMissingLevels( "aspartic_acid", missing.levels.check, example.data)

#check to see if those variables have completely missing data 
allMissingLevels(missing.level.ids, example.data)


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