Learn R Programming

W4MRUtils (version 1.0.0)

import3: Import the three W4M tables

Description

import3 Function to import the three W4M tables from files (dataMatrix, sampleMetadata, variableMetadata) import3 performs checks to ensure the identifiers match between the three tables and stops with an explicit error message in case identifiers do not match.

Usage

import3(pathDM, pathSM, pathVM, disable_comm = TRUE)

Value

a list containing three elements:

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

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

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

Arguments

pathDM

a path to a file corresponding to the dataMatrix

pathSM

a path to a file corresponding to the sampleMetadata

pathVM

a path to a file corresponding to the variableMetadata

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 files; 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"
)
vm_path <- system.file(
  "extdata",
  "mini_variablemetadata.txt",
  package="W4MRUtils"
)
sm_path <- system.file(
  "extdata",
  "mini_samplemetadata.txt",
  package="W4MRUtils"
)

## import considering # is not a comment character
A <- W4MRUtils::import3(dm_path, sm_path, vm_path)
print(A$dataMatrix[1:5, 1:5])
print(A$sampleMetadata[1:5, ])
print(A$variableMetadata[1:5, ])

## import considering # is a comment character
B <- W4MRUtils::import3(dm_path, sm_path, vm_path, disable_comm = FALSE)
print(B$dataMatrix[1:5, 1:5])
print(B$sampleMetadata[1:5, ])
print(B$variableMetadata[1:5, ])
# }

Run the code above in your browser using DataLab