HDX Resource
HDX Resource
HDX Resource, it contains all the logic for creating, checking, and updating resources
rhdx::HDXObject -> HDXResource
dataplaceholder for Resource field element
new()Create a new Resource object
HDXResource$new(initial_data = NULL, configuration = NULL)
initial_datalist with required field to create a resource
configurationa Configuration object
A new Resource object
download()Download a HDX resource
HDXResource$download( folder = NULL, filename = NULL, quiet = TRUE, force = FALSE, ... )
foldera character, folder to save the dataset
filenamea character, filename of the dataset
quieta logical value, silent download if TRUE
forcea logical value, force download
...other download.file parameters
a character, the file path
download_folder()Get the download folder for the latest downloaded resource
HDXResource$download_folder()
a character, folder with the latest downloaded resource
read_resource()Read a Resource object directly into memory
HDXResource$read_resource( sheet = NULL, layer = NULL, format = NULL, download_folder = NULL, simplify_json = TRUE, force_download = FALSE, quiet_download = TRUE, ... )
sheeta character value, only for resource in Excel format
layera character value, only for spatial (vector) resource
formata character value, file format;
download_foldera character value, folder to save the downloaded resource
simplify_jsona logical value
force_downloada logical value, if TRUE force download
quiet_downloada logical value, if TRUE silent download
...other parameters
a tibble, a sf, a stars or a list depending
on the type of resource read
get_layers()Get spatial (vector) resource list of layers
HDXResource$get_layers( format = NULL, download_folder = NULL, quiet_download = TRUE, force_download = FALSE )
formatcharacter; file format
download_foldera character value, folder to save the downloaded resource
quiet_downloada logical value, if TRUE silent download
force_downloada logical value, if TRUE force download
a the list of layers available in the resource
get_sheets()Get the list of sheets name of resource
HDXResource$get_sheets( format = NULL, download_folder = NULL, quiet_download = TRUE, force_download = FALSE )
formatcharacter; file format
download_foldera character value, folder to save the downloaded resource
quiet_downloada logical value, if TRUE silent download
force_downloada logical value, if TRUE force download
a the list of layers available in the resource
get_dataset()Get the resource dataset.
HDXResource$get_dataset()
a Dataset, the dataset containing the resource
get_required_fields()Get dataset required fields
HDXResource$get_required_fields()
list of required fields for a resource
check_required_field()Check dataset required field
HDXResource$check_required_field(check_dataset_id = FALSE)
check_dataset_idlogical whether to check or not dataset id
a logical value, TRUE if the the resource is not missing a required field and throws an error otherwise
get_format()Get the file format
HDXResource$get_format()
a character, the file format of the resource
as_list()Get resource field into list
HDXResource$as_list()
a list with resource field
browse()Browse the resource page on HDX
HDXResource$browse()
print()Print a Resource object
HDXResource$print()
clone()The objects of this class are cloneable with this method.
HDXResource$clone(deep = FALSE)
deepWhether to make a deep clone.