loadExposome {rexposome} | R Documentation |
data.frames
Given three data.frames
that defines the exposome (measures
of exposome, exposome description and individuals phentype) it loads
them and creates an object of type ExposomeSet.
loadExposome(exposures, description, phenotype, description.famCol = "family", exposures.asFactor = 5, warnings = TRUE)
exposures |
|
description |
|
phenotype |
|
description.famCol |
(default |
exposures.asFactor |
(default |
warnings |
(default |
The rows of the exposure's data.frames
, that corresponds to samples'
names, must be the same than the phenotype's data.frames
. In the
same way, the columns in exposure's data.frames
must be the same
in description data.frame
.
An object of class ExposomeSet.
ExposomeSet's fData
will contain some inner columns
called .std
, .trn
, .fct
and .type
in order to
trace the transformations an exposure suffers and to know, at eny moment, if
an exposure is categorical or continuous. The "description" file can
contains a column called type
with values "factor"
and
"numeric"
to speficy how an exposure needs to be understood. If
given, this column will be renamed to .type
. If not given, it will
be created using exposures.asFactor
value.
ExposomeSet for class description, readExposome for constructor from txt/csv files.
path <- file.path(path.package("rexposome"), "extdata") description <- file.path(path, "description.csv") phenotype <- file.path(path, "phenotypes.csv") exposures <- file.path(path, "exposures.csv") dd <- read.csv(description, header=TRUE) ee <- read.csv(exposures, header=TRUE) pp <- read.csv(phenotype, header=TRUE) rownames(dd) <- dd[, 2] dd <- dd[ , -2] rownames(ee) <- ee[ , 1] ee <- ee[ , -1] rownames(pp) <- pp[ , 1] pp <- pp[ , -1] exp <- loadExposome( exposures = ee, description = dd, phenotype = pp, description.famCol = "Family" )