View source: R/02-dictionaries_functions.R
data_dict_expand | R Documentation |
Expands data dictionary column(s) in a element (the parameter 'from'),
into another element (the parameter 'to').
If the element from
contains any column starting with 'prefix', (xx,yy),
these columns will be added as 'xx' and 'yy' in the element identified by
to
. This data frame will be created if necessary, and columns will be
added, from left to right. (unique names will be generated if necessary).
Separator of each element is the following structure :
'name = xx1 ; name = xx2'.
This function is mainly used to expand the column(s) 'Categories::xx' in
"Variables" to "Categories" element with column(s) xx.
This function is the reversed operation of data_dict_collapse()
data_dict_expand(
data_dict,
from = "Variables",
name_prefix = "Categories::",
to = "Categories"
)
data_dict |
A list of data frame(s) representing metadata to be transformed. |
from |
A symbol identifying the name of the element (data frame) to take column(s) from. Default is 'Variables'. |
name_prefix |
Character string of the prefix of columns of interest. This prefix will be used to select columns, and to rename them in the 'to' element. Default is 'Categories::'. |
to |
A symbol identifying the name of the element (data frame) to create column(s) to. Default is 'Categories'. |
A data dictionary contains the list of variables in a dataset and metadata
about the variables and can be associated with a dataset. A data dictionary
object is a list of data frame(s) named 'Variables' (required) and
'Categories' (if any). To be usable in any function, the data frame
'Variables' must contain at least the name
column, with all unique and
non-missing entries, and the data frame 'Categories' must contain at least
the variable
and name
columns, with unique combination of
variable
and name
.
A list of data frame(s) identifying a data dictionary.
data_dict_collapse()
{
# use madshapR_DEMO provided by the package
data_dict <- madshapR_DEMO$`data_dict_PARIS - collapsed`
data_dict_expand(data_dict)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.