| resource | R Documentation |
Gets or overwrites a Data Resource from/in a Data Package.
These functions are designed for internal use in other packages.
For public manipulation of resources, use add_resource() and
remove_resource().
resource() gets a Data Resource from a Data Package by its name.
The returned value will be a list describing a Data Resource, with a new
attribute data_location to indicate how the data are attached.
If present, path will be updated to the full path(s).
resource<- overwrites a Data Resource in Data Package with a new value.
The assigned value will typically be a resource obtained with resource()
and then manipulated.
The assignment function will therefore revert internal changes made by
resource() (i.e. removing the attribute data_location and updating paths
to the original values).
The assigned value is otherwise not validated, so use with care.
resource(package, resource_name)
resource(package, resource_name) <- value
package |
Data Package object, as returned by |
resource_name |
Name of the Data Resource. |
value |
Value to assign. |
See vignette("data-resource") to learn more about Data Resource.
List describing a Data Resource.
package with overwritten resource.
Other accessor functions:
resource_names(),
schema()
# Load the example Data Package
package <- example_package()
# Get the resource "deployments"
resource <- resource(package, "deployments")
str(resource)
# Update the resource
resource$description <- "Table with deployments."
# Overwrite the resource
resource(package, "deployments") <- resource
# Updating a resource property can also be done in one step
resource(package, "deployments")$description <- "Table with deployments."
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.