meta | R Documentation |
Prepares a vector for storage. When relevant, meta()
optimizes the object
for storage by changing the format to one which needs less characters. The
metadata stored in the meta
attribute, contains all required information to
back-transform the optimized format into the original format.
In case of a data.frame, meta()
applies itself to each of the columns. The
meta
attribute becomes a named list containing the metadata for each column
plus an additional ..generic
element. ..generic
is a reserved name for
the metadata and not allowed as column name in a data.frame
.
write_vc()
uses this function to prepare a dataframe for storage.
Existing metadata is passed through the optional old
argument. This
argument intended for internal use.
meta(x, ...)
## S3 method for class 'character'
meta(x, na = "NA", optimize = TRUE, ...)
## S3 method for class 'factor'
meta(x, optimize = TRUE, na = "NA", index, strict = TRUE, ...)
## S3 method for class 'logical'
meta(x, optimize = TRUE, ...)
## S3 method for class 'POSIXct'
meta(x, optimize = TRUE, ...)
## S3 method for class 'Date'
meta(x, optimize = TRUE, ...)
## S3 method for class 'data.frame'
meta(
x,
optimize = TRUE,
na = "NA",
sorting,
strict = TRUE,
split_by = character(0),
...
)
x |
the vector. |
... |
further arguments to the methods. |
na |
the string to use for missing values in the data. |
optimize |
If |
index |
An optional named vector with existing factor indices.
The names must match the existing factor levels.
Unmatched levels from |
strict |
What to do when the metadata changes. |
sorting |
an optional vector of column names defining which columns to
use for sorting |
split_by |
An optional vector of variables name to split the text files.
This creates a separate file for every combination.
We prepend these variables to the vector of |
the optimized vector x
with meta
attribute.
The default order of factor levels depends on the current locale.
See Comparison
for more details on that.
The same code on a different locale might result in a different sorting.
meta()
ignores, with a warning, any change in the order of factor levels.
Add strict = FALSE
to enforce the new order of factor levels.
Other internal:
is_git2rdata()
,
is_git2rmeta()
,
print.git2rdata()
,
summary.git2rdata()
,
upgrade_data()
meta(c(NA, "'NA'", '"NA"', "abc\tdef", "abc\ndef"))
meta(1:3)
meta(seq(1, 3, length = 4))
meta(factor(c("b", NA, "NA"), levels = c("NA", "b", "c")))
meta(factor(c("b", NA, "a"), levels = c("a", "b", "c")), optimize = FALSE)
meta(factor(c("b", NA, "a"), levels = c("a", "b", "c"), ordered = TRUE))
meta(
factor(c("b", NA, "a"), levels = c("a", "b", "c"), ordered = TRUE),
optimize = FALSE
)
meta(c(FALSE, NA, TRUE))
meta(c(FALSE, NA, TRUE), optimize = FALSE)
meta(complex(real = c(1, NA, 2), imaginary = c(3, NA, -1)))
meta(as.POSIXct("2019-02-01 10:59:59", tz = "CET"))
meta(as.POSIXct("2019-02-01 10:59:59", tz = "CET"), optimize = FALSE)
meta(as.Date("2019-02-01"))
meta(as.Date("2019-02-01"), optimize = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.