Description Usage Format Details Fields Getters/setters Public methods Author(s) References Examples
TODO
1 |
1 2 | Class 'R6ClassGenerator' <environment: 0x0000000009bde5d0>
- attr(*, "name")= chr "DataFormat_generator"
|
TODO
format
list
Data format information
See interface
IDataFormat
See interface
IDataFormat
Janko Thyson janko.thyson@rappster.de
http://github.com/rappster/datar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # Example formats ----------------------------------------------------------
format_1 <- list(
function(x, pattern = "\\d{4}-\\d{2}-\\d{2}") {
tmp <- lapply(x, function(ii) {
if (any(grepl(pattern, ii))) {
as.POSIXlt(ii)
} else {
ii
}
})
as.data.frame(tmp, stringsAsFactors = FALSE)
},
function(x) {
names(x) <- gsub("\\.", "_", names(x))
x
}
)
format_2 <- list(
function(x, pattern = "\\d{4}-\\d{2}-\\d{2}") {
tmp <- lapply(x, function(ii) {
if (any(grepl(pattern, ii))) {
as.character(ii)
} else {
ii
}
})
as.data.frame(tmp, stringsAsFactors = FALSE)
},
function(x) {
names(x) <- gsub("_", ".", names(x))
x
}
)
# Instantiate -------------------------------------------------------------
format_1_inst <- DataFormat$new(format = format_1)
format_2_inst <- DataFormat$new(format = format_2)
# Methods -----------------------------------------------------------------
format_1_inst$getFormat()
format_1_inst$setFormat(NULL)
format_1_inst$getFormat()
format_1_inst$setFormat(format_2)
format_1_inst$getFormat()
format_2_inst$getFormat()
format_2_inst$setFormat(NULL)
format_2_inst$getFormat()
format_2_inst$setFormat(format_1)
format_2_inst$getFormat()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.