Query or alter sample meta information in AnalysisData
or Analysis
class objects.
Replace a given sample info column from an Analysis or AnalysisData object.
Usage
clsAdd(d, cls, value, ...)
# S4 method for AnalysisData
clsAdd(d, cls, value)
# S4 method for Analysis
clsAdd(d, cls, value, type = c("pre-treated", "raw"))
clsArrange(d, cls = "class", descending = FALSE, ...)
# S4 method for AnalysisData
clsArrange(d, cls = "class", descending = FALSE)
# S4 method for Analysis
clsArrange(
d,
cls = "class",
descending = FALSE,
type = c("pre-treated", "raw")
)
clsAvailable(d, ...)
# S4 method for AnalysisData
clsAvailable(d)
# S4 method for Analysis
clsAvailable(d, type = c("pre-treated", "raw"))
clsExtract(d, cls = "class", ...)
# S4 method for AnalysisData
clsExtract(d, cls = "class")
# S4 method for Analysis
clsExtract(d, cls = "class", type = c("pre-treated", "raw"))
clsRemove(d, cls, ...)
# S4 method for AnalysisData
clsRemove(d, cls)
# S4 method for Analysis
clsRemove(d, cls, type = c("pre-treated", "raw"))
clsRename(d, cls, newName, ...)
# S4 method for AnalysisData
clsRename(d, cls, newName)
# S4 method for Analysis
clsRename(d, cls, newName, type = c("pre-treated", "raw"))
clsReplace(d, value, cls = "class", ...)
# S4 method for AnalysisData
clsReplace(d, value, cls = "class")
# S4 method for Analysis
clsReplace(d, value, cls = "class", type = c("pre-treated", "raw"))
Arguments
- d
S4 object of class Analysis or AnalysisData
- cls
sample info column to extract
- value
vactor of new sample information for replacement
- ...
arguments to pass to specific method
- type
raw
orpre-treated
sample information- descending
TRUE/FALSE, arrange samples in descending order
- newName
new column name
Methods
clsAdd
: Add a sample information column.clsArrange
: Arrange sample row order by a specified sample information column.clsAvailable
: Retrieve the names of the available sample information columns.clsExtract
: Extract the values of a specified sample information column.clsRemove
: Remove a sample information column.clsRename
: Rename a sample information column.clsReplace
: Replace a sample information column.
Examples
library(metaboData)
d <- analysisData(abr1$neg,abr1$fact)
## Add a sample information column named 'new'
d <- clsAdd(d,'new',1:nSamples(d))
print(d)
#>
#> AnalysisData object containing:
#>
#> Samples: 120
#> Features: 2000
#> Info: 10
#>
## Arrange the row orders by the 'day' column
d <- clsArrange(d,'day')
clsExtract(d,'day')
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
#> [38] 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4
#> [75] 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 H H H H H H H H H H H
#> [112] H H H H H H H H H
#> Levels: 1 2 3 4 5 H
## Retreive the available sample information column names
clsAvailable(d)
#> [1] "injorder" "pathcdf" "filecdf" "name.org" "remark" "name"
#> [7] "rep" "day" "class" "new"
## Extract the values of the 'day' column
clsExtract(d,'day')
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
#> [38] 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4
#> [75] 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 H H H H H H H H H H H
#> [112] H H H H H H H H H
#> Levels: 1 2 3 4 5 H
## Remove the 'class' column
d <- clsRemove(d,'class')
clsAvailable(d)
#> [1] "injorder" "pathcdf" "filecdf" "name.org" "remark" "name" "rep"
#> [8] "day" "new"
## Rename the 'day' column to 'treatment'
d <- clsRename(d,'day','treatment')
clsAvailable(d)
#> [1] "injorder" "pathcdf" "filecdf" "name.org" "remark" "name"
#> [7] "rep" "treatment" "new"
## Replace the values of the 'treatment' column
d <- clsReplace(d,rep(1,nSamples(d)),'treatment')
clsExtract(d,'treatment')
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [112] 1 1 1 1 1 1 1 1 1