loadExposome_plain: Creation of an ExposomeSet from single 'data.frame'

Description Usage Arguments Value Examples

View source: R/loadExposome_plain.R

Description

Creation of an ExposomeSet from single data.frame

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
loadExposome_plain(
  data,
  data_id,
  sep = ",",
  pheno_cols,
  na.strings = c("NA", "-", "?", " ", ""),
  families = NULL,
  exposures.asFactor = 5,
  warnings = TRUE
)

Arguments

data

data.frame With the exposures and phenotypes (in no particular order!) or string with the path to a file (.csv, .tsv, .txt) with the table of exposures and phenotypes

data_id

character Name of the column on the selected table that contains the ID

sep

character (default ",") Separator used by read.table to load the files "exposures", "description" and "phenotype". Only applies when providing a path on the data argument

pheno_cols

character Character vector of the phenotype columns (all the other columns are considered exposures)

na.strings

character (default c("NA", "-", "?", " ", "")) Character defining the NA values in expsome's files.

families

list (default NULL) List to specify the families of the exposures, construct it as: list(Family1 = c("exposure_1_1", "exposure_1_2", "exposure_1_n"), Family2 = c("exposure_2_1", "exposure_2_2", "exposure_2_n"), FamilyM = c("exposure_M_1", "exposure_M_2", "exposure_M_n")). All the exposures on the data table have to be on this provided list with their respective families. The family classification is optional, input NULL to bypass the family classifier

exposures.asFactor

numeric (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.

Value

An object of class ExposomeSet.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
path <- file.path(path.package("rexposome"), "extdata")
phenotype <- file.path(path, "phenotypes.csv")
exposures <- file.path(path, "exposures.csv")
ee <- read.csv(exposures, header=TRUE)
pp <- read.csv(phenotype, header=TRUE)
# Create fake dataset with exposures and phenotypes combined
data <- cbind(ee, pp)

loadExposome_plain <- function(data, data_id = "idnum",
pheno_cols = c("rhinitis", "wheezing", "sex", "age", "cbmi", "blood_pre", "whistling_chest","flu"))

rexposome documentation built on March 13, 2021, 2:01 a.m.