Skip to contents

This function reads in the environmental data that accompanies the genetic data read in with genDataRead.

Usage

envDataRead(
  file.in = stop("'file.in' must be given!"),
  dir.in = ".",
  file.out = NULL,
  dir.out = ".",
  sep = ",",
  cont = TRUE,
  header = TRUE,
  rownames = TRUE,
  overwrite = NULL
)

Arguments

file.in

The name of the file with environmental data.

dir.in

The path to the directory where the 'file.in' resides.

file.out

The base name for the output files (see Details).

dir.out

The path to the directory where the output files will be saved.

sep

The separator character that separates values in each line of the file; "," by default (as in a csv file).

cont

Logical - are the values continuous (TRUE, default) or categories (FALSE)? See Details.

header

Logical indicating whether the first line of the file is a header; default TRUE.

rownames

Default (TRUE) indicates that the first column of the file includes names of rows. If a character vector is given here, these names are used as rownames; if FALSE, no rownames are used.

overwrite

Logical: if a file with the given name exists, should it be overwritten or not? If NULL, the user will be prompt for input.

Value

A list of ffdf objects with the environmental data in numeric format.

Details

The environmental data such as methylation data can be large if the information is stored on per-SNP basis. Thus, when data is large, this function reads it in andcreates a special ff object that stores the data without limiting the memory available. This can take time but needs to be performed only once. Later on, one can use the envDataLoad function to load the appropriate data from .ffData file saved to disk, which is a quick process.

Details

If 'file.out' is not given, the default is NULL and the output filenames are constructed based on the input filenames. The '_env' suffix is added to the base name and the .ffData file is written to disk. This file contains all the information needed to restore the ffdf object by calling envDataLoad function later on.

If 'cont' is TRUE (default), the output data will be a list of ff matrices containing single-precision values. However, before using this data as stratification values, the user needs to create categories - this can be done manually or with the provided envDataCategorize function.