Learn R Programming

W4MRUtils (version 1.0.0)

import2: Import two W4M tables

Description

import2 Function to import a metadata table file and its corresponding dataMatrix file. import2 performs checks to ensure the identifiers match between the two tables and stops with an explicit error message in case identifiers do not match.

Usage

import2(pathDM, pathMeta, typeMeta, disable_comm = TRUE)

Value

a list containing two elements:

  • dataMatrix a data.frame corresponding to the imported dataMatrix table;

  • metadata a data.frame corresponding to the imported metadata table

Arguments

pathDM

a path to a file corresponding to the dataMatrix

pathMeta

a path to a file corresponding to the metadata table

typeMeta

"sample" or "variable" depending on the metadata content

disable_comm

a boolean with default to TRUE to indicate whether the comment character # should be disabled as a comment tag for the import of the metadata file; when TRUE, # in the metadata table's columns will be considered as any other character.

Author

M.Petera

Examples

Run this code
# \donttest{

dm_path <- system.file(
  "extdata",
  "mini_datamatrix.txt",
  package="W4MRUtils"
)
meta_path <- system.file(
  "extdata",
  "mini_variablemetadata.txt",
  package="W4MRUtils"
)

## import considering # is not a comment character
A <- W4MRUtils::import2(dm_path, meta_path, "variable")
print(A$dataMatrix[1:5, 1:5])
print(A$metadata[1:5, ])

## import considering # is a comment character
B <- W4MRUtils::import2(dm_path, meta_path, "variable", disable_comm = FALSE)
print(B$dataMatrix[1:5, 1:5])
print(B$metadata[1:5, ])
# }

Run the code above in your browser using DataLab