Learn R Programming

W4MRUtils (version 1.0.0)

stock_id: Stock ID

Description

stock_id Functions to stock identifiers before applying make.names() and to reinject it into final matrices. stock_id stocks original identifiers and original order needs checked data regarding table match.

Usage

stock_id(data_matrix, metadata, metadata_type)

Value

a names list with three elements:

  • id.match a data.frame that contains original order of ids, names ;

  • dataMatrix the modified data matrix with names sanitized

  • Metadata the modified metadata matrix with names sanitized This object can be used in reproduce_id() to replace sanitized names in data matrix by original ones, in the right order.

Arguments

data_matrix

a data.frame containing the data_matrix

metadata

a data.frame containing samplemetadata or variablemetadata

metadata_type

"sample" or "variable" depending on metadata content

Author

M.Petera

Examples

Run this code
# \donttest{

myDM <- data.frame(data = 1:6, a = 2:7, b = 3:8, c = 2:7, d = 3:8, e = 2:7)
myvM <- data.frame(variable = 1:6, x = 4:9, y = 2:7, z = 3:8)

A <- W4MRUtils::stock_id(myDM, myvM, "variable")
myDM <- A$dataMatrix
myvM <- A$Metadata
A <- A$id.match

## processing that may change order or requires specific identifiers format
## ...
datamatrix <- as.data.frame(myDM)
sample_metadata <- as.data.frame(myvM)

B <- W4MRUtils::reproduce_id(datamatrix, sample_metadata, "variable", A)
datamatrix <- B$dataMatrix
sample_metadata <- B$Metadata
# }

Run the code above in your browser using DataLab