rdf_to_rwtbl {RWDataPlyr} | R Documentation |
Convert an rdf to a tibble
Description
rdf_to_rwtbl()
converts an rdf list to a tibble.
Usage
rdf_to_rwtbl(rdf, scenario = NULL, keep_cols = FALSE, add_ym = TRUE)
rdf_to_rwtbl2(file, scenario = NA_character_, keep_cols = FALSE, add_ym = TRUE)
Arguments
rdf |
An rdf object (from |
scenario |
An optional parameter, that if it is not |
keep_cols |
Either boolean, or a character vector of column names to
keep in the returned tibble. The values of
|
add_ym |
Boolean that controls whether or not |
file |
The relative or absolute rdf filename. |
Details
The rdf object is converted to a data frame, and then converted to a
tibble::tibble()
. All of the meta
entries in the rdf object
are stored as attributes in the returned tibble. These attributes are:
mrm_config_name
, owner
, description
, create_date
, and n_traces
.
If the rdf contains a scalar slot(s), the scalar slot value(s) will be repeated for every timestep.
Value
A tbl_df with additional attributes from the rdf object.
See Also
Examples
rdftbl <- rdf_to_rwtbl(keyRdf)
# same as previous, except you do not want "Year" and "Month" columns
rdftbl <- rdf_to_rwtbl(keyRdf, add_ym = FALSE)
# but you do want to keep the object name seperately:
rdftbl <- rdf_to_rwtbl(keyRdf, add_ym = FALSE, keep_cols = "Object")
rdftbl <- rdf_to_rwtbl(sysRdf, scenario = "ISM1988_2014,2007Dems,IG,2002")
# rdf_to_rwtbl2 wants a file path instead of an rdf object
rdfPath <- system.file(
"extdata/Scenario/ISM1988_2014,2007Dems,IG,Most/KeySlots.rdf",
package = "RWDataPlyr"
)
rdftbl <- rdf_to_rwtbl2(rdfPath)