loadImputed: Creation of an imExposomeSet from 'data.frames'

View source: R/loadImputed.R

loadImputedR Documentation

Creation of an imExposomeSet from data.frames

Description

Given a data.frame from code with the multiple imputations of both exposures and phenotypes, join with a data.frame with exposures' description, and object of class imExposomeSet is created.

Usage

loadImputed(
  data,
  description,
  description.famCol = "family",
  description.expCol = "exposure",
  exposures.asFactor = 5,
  warnings = TRUE
)

Arguments

data

The data.frame of both exposures and phentoypes obtained from mice.

description

data.frame with the description of the exposures (relation between exposures and exposure-family).

description.famCol

(default "family") Index where the family's name (per exposures) if found in file "description". It can be both numeric or character.

description.expCol

(default "exposures") Index where the exposure's name if found in file "description". It can be both numeric or character.

exposures.asFactor

(default 5) The exposures with more than this number of unique items will be considered as "continuous" while the exposures with less or equal number of items will be considered as "factor".

warnings

(default TRUE) If TRUE shows useful information/warnings from the process of loading the exposome.

Details

The coordination of the information is based in the columns .imp and .id from the data.frame obtained from mice. The division of exposures and phenotypes is based in description data.frame, that are the exposures. Hence, the elements in the main data.frame that are not in the description, are the phentoypes.

Value

An object of class imExposomeSet.

See Also

imExposomeSet for class description

Examples

data("me") # me is an imputed matrix of exposure and phenotyes
path <- file.path(path.package("rexposome"), "extdata")
description <- file.path(path, "description.csv")
dd <- read.csv(description, header=TRUE, stringsAsFactors=FALSE)
dd <- dd[dd$Exposure %in% colnames(me), ]
ex_imp <- loadImputed(data = me, description = dd,
description.famCol = "Family",
description.expCol = "Exposure")

isglobal-brge/rexposome documentation built on Feb. 4, 2023, 12:35 p.m.