Title: | Retrieve Data using the API of the 'Pandora' Data Platform |
---|---|
Description: | API wrapper that contains functions to retrieve data from the 'Pandora' databases. Web services for API: <https://pandora.earth/>. |
Authors: | Jan Abel [cre], Antonia Runge [aut], Andreas Neudecker [aut], Ricardo Fernandes [aut] |
Maintainer: | Jan Abel <[email protected]> |
License: | GPL (>= 3) |
Version: | 24.2.0 |
Built: | 2024-10-31 05:36:41 UTC |
Source: | https://github.com/pandora-isomemo/pandora-data |
Call API
callAPI( action = c("current_package_list_with_resources", "group_list", "package_list", "organization_list", "tag_list"), ... )
callAPI( action = c("current_package_list_with_resources", "group_list", "package_list", "organization_list", "tag_list"), ... )
action |
(character) name of the endpoint "mapping" |
... |
parameters for the endpoint, e.g. all_fields = "true" |
(data.frame) output from the Pandora API
Set options for utils::read.csv()
, openxlsx::read.xlsx()
or
readxl::read_excel
. Choose delimiter and decimal separator as well
as sheetnumbner and number of rows to read.
dataOptions( nrows = NA_integer_, colNames = TRUE, sep = ",", dec = ".", fileEncoding = "", sheet = 1 )
dataOptions( nrows = NA_integer_, colNames = TRUE, sep = ",", dec = ".", fileEncoding = "", sheet = 1 )
nrows |
integer: the maximum number of rows to read in. Negative and other invalid values are ignored. |
colNames |
If |
sep |
the field separator character. Values on each line of the
file are separated by this character. If |
dec |
the character used in the file for decimal points. |
fileEncoding |
character string: if non-empty declares the
encoding used on a file (not a connection) so the character data can
be re-encoded. See the ‘Encoding’ section of the help for
|
sheet |
The name or index of the sheet to read data from. |
a list of extra options for utils::read.csv()
or openxlsx::read.xlsx()
or
readxl::read_excel
, respectively
Search for pattern in all columns of datAPI and filter respective rows
filterPattern(datAPI, pattern = "")
filterPattern(datAPI, pattern = "")
datAPI |
(list) output from the Pandora API |
pattern |
(character) string for filtering all meta information |
(list) a data.frame with rows that contain the pattern
Filter Resource by Name
filterResourceByName(resource, name)
filterResourceByName(resource, name)
resource |
(data.frame) resources data frame |
name |
(character) name of a resource |
(data.frame) filtered resource
Filter Resource by Valid File Type
filterValidFileType(resource, name)
filterValidFileType(resource, name)
resource |
(data.frame) resources data frame |
name |
(character) name of a resource |
(data.frame) filtered resource
Apply names from the 'Additional Info' box from 'https://pandoradata.earth/dataset/' to the columns of returned data
formatRepositoryList( packageList, columns = getDatasetFields(), renameColumns = TRUE )
formatRepositoryList( packageList, columns = getDatasetFields(), renameColumns = TRUE )
packageList |
(data.frame) optional, output of callAPI() e.g. from a previous call to the Pandora API. |
columns |
(character) names of columns that should be returned |
renameColumns |
(logical) apply names from the 'Additional Info' box from 'https://pandoradata.earth/dataset/' to the columns of returned data |
(data.frame) containing available repositories
Get Data
getData(name, repository = "", verbose = TRUE, options = dataOptions())
getData(name, repository = "", verbose = TRUE, options = dataOptions())
name |
(character) name of a resource, e.g. an entry of the output from
|
repository |
(character) name of a Pandora repository, e.g. an entry of the output from
|
verbose |
Logical, indicating whether to display processing messages. If TRUE, messages will be displayed; if FALSE, messages will be suppressed. Default is TRUE. |
options |
(list) a list of extra options for |
(data.frame) return data from the Pandora API
Names of particular meta fields from the 'Additional Info' box from 'https://pandoradata.earth/dataset/'
getDatasetFields()
getDatasetFields()
(character vector) names of meta fields
Get all available file types of a repository or those within a specific network or within a specific repository optional filtering of meta information for a given string
getFileTypes( repository = "", network = "", pattern = "", order = TRUE, packageList = data.frame() )
getFileTypes( repository = "", network = "", pattern = "", order = TRUE, packageList = data.frame() )
repository |
(character) name of a Pandora repository, e.g. an entry of the output from
|
network |
(character) name of a Pandora network, e.g. an entry of the output from
|
pattern |
(character) string for meta information search |
order |
(logical) if TRUE, order dataframe alphabetically by 'repository' and 'name' |
packageList |
(data.frame) optional, output of callAPI() e.g. from a previous call to the Pandora API. |
(data.frame) containing available file types within a repository
Get all available networks (groups in CKAN terminology) optional filtering of names for a given string
getNetworks(pattern = "", order = TRUE, groupList = data.frame())
getNetworks(pattern = "", order = TRUE, groupList = data.frame())
pattern |
(character) string for meta information search |
order |
(logical) if TRUE, order dataframe alphabetically by 'repository' and 'name' |
groupList |
(data.frame) optional, output of callAPI() from a previous call to the Pandora API. |
(data.frame) giving the "name" and "display_name" of available Pandora networks (groups in CKAN terminology)
get nRow
getNrow(type, nrows = NA_integer_)
getNrow(type, nrows = NA_integer_)
type |
(character) file type |
nrows |
integer: the maximum number of rows to read in. Negative and other invalid values are ignored. |
Get all vailable repositories or those within a specific network optional filtering of meta information for a given string
getRepositories( network = "", pattern = "", order = TRUE, columns = getDatasetFields(), renameColumns = TRUE, packageList = data.frame() )
getRepositories( network = "", pattern = "", order = TRUE, columns = getDatasetFields(), renameColumns = TRUE, packageList = data.frame() )
network |
(character) name of a Pandora network, e.g. an entry of the output from
|
pattern |
(character) string for meta information search |
order |
(logical) if TRUE, order dataframe alphabetically by 'repository' and 'name' |
columns |
(character) names of columns that should be returned |
renameColumns |
(logical) apply names from the 'Additional Info' box from 'https://pandoradata.earth/dataset/' to the columns of returned data |
packageList |
(data.frame) optional, output of callAPI() e.g. from a previous call to the Pandora API. |
(data.frame) containing available repositories
Get all available resources within a repository or filtered by file type or those within a specific network or within a specific repository optional filtering of meta information for a given string
getResources( fileType = character(), repository = "", network = "", pattern = "", order = TRUE, packageList = data.frame() )
getResources( fileType = character(), repository = "", network = "", pattern = "", order = TRUE, packageList = data.frame() )
fileType |
(character) list of relevant file types, e.g. c("xls", "xlsx", "csv", "odt") |
repository |
(character) name of a Pandora repository, e.g. an entry of the output from
|
network |
(character) name of a Pandora network, e.g. an entry of the output from
|
pattern |
(character) string for meta information search |
order |
(logical) if TRUE, order dataframe alphabetically by 'repository' and 'name' |
packageList |
(data.frame) optional, output of callAPI() e.g. from a previous call to the Pandora API. |
(data.frame) containing available resources within a repository
Checks if package is used with an older R version which possibly leads to encryption errors on Windows. Gives a warning in that case.
isOldROnWindows()
isOldROnWindows()
(logical) TRUE if system is Windows and R version is < 4.2.0
Load Data
loadData( path, type = c("xlsx", "xls", "odt", "csv", "txt"), nrows = NA_integer_, sep = ",", dec = ".", fileEncoding = "", colNames = TRUE, sheet = 1, verbose = TRUE )
loadData( path, type = c("xlsx", "xls", "odt", "csv", "txt"), nrows = NA_integer_, sep = ",", dec = ".", fileEncoding = "", colNames = TRUE, sheet = 1, verbose = TRUE )
path |
path to the file |
type |
(character) type of file, one of |
nrows |
integer: the maximum number of rows to read in. Negative and other invalid values are ignored. |
sep |
the field separator character. Values on each line of the
file are separated by this character. If |
dec |
the character used in the file for decimal points. |
fileEncoding |
character string: if non-empty declares the
encoding used on a file (not a connection) so the character data can
be re-encoded. See the ‘Encoding’ section of the help for
|
colNames |
If |
sheet |
The name or index of the sheet to read data from. |
verbose |
Logical, indicating whether to display processing messages. If TRUE, messages will be displayed; if FALSE, messages will be suppressed. Default is TRUE. |
(data.frame) data loaded from the file at path
Select Single File from Resources
selectSingleFile(resource)
selectSingleFile(resource)
resource |
(data.frame) resources data frame |
(data.frame) selected resource
Validate Resource
validateResource(resource, repository)
validateResource(resource, repository)
resource |
(data.frame) resources data frame |
repository |
(character) name of a Pandora repository, e.g. an entry of the output from
|
(data.frame) resource, or error if empty