Clarion {wilson} | R Documentation |
Clarion R6-class definition
Description
Use this to create a clarion object. This object is used by all top-level wilson modules.
Constructor
Clarion$new(header = NULL, metadata, data, validate = TRUE)
Constructor Arguments
Variable | Return |
header | A named list. Defaults to NULL. |
metadata | Clarion metadata in form of a data.table. |
data | Data.table according to metadata. |
validate | Logical value to validate on initialization. Defaults to TRUE. |
Public fields
header
List of global information regarding the whole experiment.
metadata
Data.table with additional information for each column.
data
Data.table containing experiment result data.
Methods
Public methods
Method get_id()
Returns name of unique identifier column. Assumes first feature to be unique if not specified.
Usage
Clarion$get_id()
Returns
Name of the id column.
Method get_name()
Returns name of name column. If not specified return unique Id.
Usage
Clarion$get_name()
Returns
Name of the name column.
Method get_delimiter()
Return delimiter used within multi-value fields (no delimiter = NULL).
Usage
Clarion$get_delimiter()
Method is_delimited()
Logical whether the given column name is delimited.
Usage
Clarion$is_delimited(x)
Arguments
x
Name of the column.
Returns
boolean
Method get_factors()
Get factors to all columns.
Usage
Clarion$get_factors()
Details
Named factors (e.g. factor1="name") will be cropped to their name.
Returns
Returns a data.table columns: key and factor(s) if any.
Method get_level()
Get level(s) to given column name(s).
Usage
Clarion$get_level(column)
Arguments
column
One or more column name(s).
Returns
Provide a vector of levels to the given columnnames in column. Returns NA for missing columns and character(0) if column = NULL.
Method get_label()
Get label(s) to given column name(s).
Usage
Clarion$get_label(column = NULL, sub_label = TRUE, sep = " ")
Arguments
column
One or more column name(s).
sub_label
Whether the sub_label should be included.
sep
Separator between label and sub_label.
Details
If a column does not have a label the key is returned.
Returns
Provides a vector of labels (+ sub_label) to the given columnnames in column. Returns NA for missing columns and all labels if column = NULL.
Method validate()
Check the object for inconsistencies.
Usage
Clarion$validate(solve = TRUE)
Arguments
solve
For solve = TRUE try to resolve some warnings.
Method new()
Initialize a new clarion object.
Usage
Clarion$new(header = NULL, metadata, data, validate = TRUE)
Arguments
header
A named list. Defaults to NULL.
metadata
Clarion metadata in form of a data.table.
data
Data.table according to metadata.
validate
Logical value to validate on initialization. Defaults to TRUE.
Returns
Clarion object.
Method write()
Save the object as a clarion file.
Usage
Clarion$write(file)
Arguments
file
Filename for the file to be written.
Method clone()
The objects of this class are cloneable with this method.
Usage
Clarion$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## Not run:
# initializing a new object
object <- Clarion$new(header, metadata, data, validate = TRUE)
# create a deep copy
object_copy <- object$clone(deep = TRUE)
## End(Not run)