The dataset_df
constructor creates the objects of this class, which
are semantically rich, modern data frames inherited from
tibble::tibble
.
Usage
dataset_df(
...,
identifier = c(eg = "http://example.com/dataset#"),
var_labels = NULL,
units = NULL,
definitions = NULL,
dataset_bibentry = NULL,
dataset_subject = NULL
)
as_dataset_df(
df,
identifier = c(eg = "http://example.com/dataset#"),
var_labels = NULL,
units = NULL,
definitions = NULL,
dataset_bibentry = NULL,
dataset_subject = NULL,
...
)
is.dataset_df(x)
# S3 method for class 'dataset_df'
print(x, ...)
is_dataset_df(x)
Arguments
- ...
The vectors (variables) that should be included in the dataset.
- identifier
Defaults to
c(eg="http://example.com/dataset#")
, which should be changed to the permanent identifier of the dataset. For example, if your dataset will be released with the Digital Object Identifier (DOI)https;//doi.org/1234
, you should use a short prefixed identifier likec(obs="https://doi.org/1234#")
, which will resolve to the rows being identified as https://doi.org/1234#1...https://doi.org/1234#n.- var_labels
The long, human readable labels of each variable.
- units
The units of measurement for the measured variables.
- definitions
The linked definitions of the variables, attributes, or constants.
- dataset_bibentry
A list of bibliographic references and descriptive metadata about the dataset as a whole created with
datacite
ordublincore
.- dataset_subject
The subject of the dataset, see
subject
.- df
A
data.frame
to be converted todataset_df
.- x
A
dataset_df
object for S3 methods.
Value
dataset_df
is the constructor of this type, it returns an object
inherited from a data frame with semantically rich metadata.
is.dataset_df
returns a logical value
(if the object is of class dataset_df
.)
Details
To check if an object has the class dataset_df use is.dataset_df
.print
is the method to print out the semantically rich data frames
created with the constructor of dataset_df
.summary
is the method to summarise these semantically rich data frames.
For more details, please check the vignette("dataset_df", package = "dataset")
vignette.
Examples
my_dataset <- dataset_df(
country_name = defined(
c("AD", "LI"),
definition = "http://data.europa.eu/bna/c_6c2bb82d",
namespace = "https://www.geonames.org/countries/$1/"),
gdp = defined(
c(3897, 7365),
label = "Gross Domestic Product",
unit = "million dollars",
definition = "http://data.europa.eu/83i/aa/GDP")
)
print(my_dataset)
#> Unknown A (????). "Untitled Dataset."
#> rowid country_name gdp
#> <hvn_lbl_> <hvn_lbl_> <hvn_lbl_>
#> 1 eg:1 AD 3897
#> 2 eg:2 LI 7365
is.dataset_df(my_dataset)
#> [1] TRUE