Formatter: Formatter Object

Description Usage Format Value Methods Fields Examples

Description

Class allowing to format data following a certain data_definition. If no data_definition is given, the varibale names can be reformated to snake_case automatically using rename

Usage

1

Format

R6Class object.

Value

Object of R6Class

Methods

new(data = NULL, data_definition = NULL, rename = T, check_type = T)

This method is used to create an instance of the Formatter class

set_data (data, data_definition = NULL, auto_rename = F, check_type = T)

This method is used to set the data to be formatted.

set_data_definition (data_definition = NULL, check_type = T)

This methods allows to setup the data definition propert and reformat the data accordingly.

get_data_definition ()

Returns current data_definition, if none is set it returns a default object.

Fields

data_definition

data.table or data.frame defining the format of data. Fields are : variable_name, formatted_name, variable_type, is_subject_id, is_group_variable, source (raw measurement : "raw" , or computed from: "variable_a,variable_b") description: range values - how was it obtained - what does it represent - how can it be reproduced

Examples

1
2
3
4
5
## Not run: 
data <- data.table(a = c(10,7), b = c("A", "B"))
data_definition <- data.table(variable_name = c("a", "b", "c"), formatted_name = c("a", "beta", "ceta"), variable_type = c("numeric", "factor", "character"), source = c("raw", "a", "raw"), description = c("0 to 10 - measure of awesomness", "A,B, or C - category of awesomnes computed from a", "just C"))

## End(Not run)

albertbuchard/r-pipeline documentation built on May 5, 2019, 6:57 p.m.