as_dataschema {Rmonize} | R Documentation |
Validate and coerce as a DataSchema object
Description
Checks if an object is a valid DataSchema and returns it with the appropriate
Rmonize::class
attribute. This function mainly helps validate inputs within
other functions of the package but could be used separately to ensure that an
object has an appropriate structure.
Usage
as_dataschema(object, as_dataschema_mlstr = FALSE)
Arguments
object |
A potential DataSchema object to be coerced. |
as_dataschema_mlstr |
Whether the output DataSchema should be coerced with specific format restrictions for compatibility with other Maelstrom Research software. FALSE by default. |
Details
A DataSchema is the list of core variables to generate across datasets and
related metadata. A DataSchema object is a list of data frames with elements
named 'Variables' (required) and 'Categories' (if any). The 'Variables'
element must contain at least the name
column, and the 'Categories'
element must contain at least the variable
and name
columns to be usable
in any function. In 'Variables' the name
column must also have unique
entries, and in 'Categories' the combination of variable
and name
columns
must also be unique.
The object may be specifically formatted to be compatible with additional Maelstrom Research software, in particular Opal environments.
Value
A list of data frame(s) named 'Variables' and (if any) 'Categories',
with Rmonize::class
'dataschema'.
Examples
{
# Use Rmonize_DEMO to run examples.
library(dplyr)
glimpse(as_dataschema(Rmonize_DEMO$`dataschema - final`))
}