Low-level constructor of the admiral_df class: adds the class to a data
frame (unless it is already present), preserving the existing classes such
as tbl_df/data.frame, and stores any metadata supplied. The arguments are
not checked, so this is what admiral's derive_*() and related
dataset-producing functions apply to their output. Users call
admiral_df(), which validates its arguments before calling this.
Arguments
- x
-
A data frame (or
NULL)- Default value
none
- dataset_keys
-
Character vector of key variables, stored in the
"admiral_dataset_keys"attribute- Default value
NULL
- dataset_name
-
Character scalar, stored in the
"admiral_dataset_name"attribute- Default value
NULL
- dataset_class
-
Character scalar, stored in the
"admiral_dataset_class"attribute- Default value
NULL
Value
If x is NULL, NULL is returned unchanged. Otherwise x with the
supplied attributes set and "admiral_df" prepended to its class
attribute.
Details
An argument left as NULL leaves the corresponding attribute untouched, so
that tagging a dataset which already carries metadata does not remove it.
