idMissingLevels: A function to determine the levels of a categorical variable...

Description Usage Arguments Value Author(s) Examples

View source: R/idMissingLevels.R

Description

This function determines the levels of a categorical variable with completely missing outcome data.

Usage

1
idMissingLevels( yname,  missing.levels.list,  dataset)

Arguments

yname

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

missing.levels.list

A named list indicating whether categorical predictors in argument dataset have levels where argument yname is completely missing. The names of the list objects should be metabolite names, and should include argument yname.

dataset

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

Value

Returns a list of the specific levels of the categorical variables included in missing.levels.list that are missing all values for the metabolite specified in yname.

Author(s)

Michael Nodzenski

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#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
idMissingLevels( "aspartic_acid", missing.levels.check, example.data)

metabomxtr documentation built on Nov. 8, 2020, 6:50 p.m.