pxweb v0.9.1

0

Monthly downloads

0th

Percentile

R Interface to PXWEB APIs

Generic interface for the PX-Web/PC-Axis API. The PX-Web/PC-Axis API is used by organizations such as Statistics Sweden and Statistics Finland to disseminate data. The R package can interact with all PX-Web/PC-Axis APIs to fetch information about the data hierarchy, extract metadata and extract and parse statistics to R data.frame format. PX-Web is a solution to disseminate PC-Axis data files in dynamic tables on the web. Since 2013 PX-Web contains an API to disseminate PC-Axis files.

Functions in pxweb

Name Description
ApiData PX-Web Data by API
MakeUrl MakeUrl from id
assert_pxweb_data_jsonstat Assert that x is a correct pxweb_data_jsonstat object. Assert a json-stat version 1.0 or later object
assert_pxweb_database_list Assert that x is a correct pxweb_database_list object.
assert_pxweb_rda_file_path Assert that the rda_file_path is correct
assert_pxweb_url Assert that the url structure is correct
get_pxweb_data Get data from a bottom node in PX-WEB API
get_pxweb_dims Get data dimensions form a bottom node in a PX-Web/PC-Axis API
is_pxweb_config_response Check if a response is a pxweb config response
parse_url_or_fail Parse a character string or throws error if it fails
pxe_metadata_choices Get and set pxe_metadata_coices
pxe_metadata_variable_names Get the meta data variable names from a pxweb_explorer object.
pxe_pxobj_at_position Return the pxweb object at the current position
pxweb-package Interface to PX-WEB APIs from R
pxweb_c Combine pxweb objects
pxweb_cite Cite a PXWEB data object
pxweb_data_c Combine pxweb objects
api_catalogue Get the api catalogue
pxweb_data_colnames Get query filter
pxweb_levels_remove_headers Remove headers from PXWEB levels object
api_parameters Return options for database, version and language choices
pxweb_metadata Construct a pxweb_metadata object.
assert_pxweb_calls Assert that the rda_file_path is correct
assert_pxweb_config Assert that the config slot is correct
pxweb_query_dim_splittable Get vector indicating splittable variables
pxweb_query_filter Get query values
Number Adding leading zeros
pxweb_validate_query_with_metadata Validate a pxweb_query with a pxweb_metadata object
build_pxweb_url.url Build the url to get the config from a PXWEB api
add_pxe_defaults Add default values to pxe
reorder_and_check_dims Reorders the dimensions of a get_pxweb_data() call and checks that all dimensions are correct.
base_url Return base URL to API
build_pxweb_rda_file_path Build or get the tmp_rda_file_path from an url or pxweb_api_s3 object
test_pxweb_api Test a full or a part of an pxweb api.
assert_pxweb Assert that the url structure is correct
assert_pxweb_api_catalogue Assert a pxweb_api_catalogue object
generate_permutations Generate batch permutations
getContent Get content from response
test_pxweb_api_get_data Download data for each bottom node in the pxweb api
assert_pxweb_input_allowed Assert a pxweb_input_allowed object
assert_pxweb_levels Assert that x is a correct pxweb_levels object.
buildPath Build a path from character elements
pxd_values_to_valuetexts Convert a pxweb data objects values to valuetext
pxe_data_url Get the url to a table
get_api_file_path Refactorized function to get api_file path and copy if needed
get_api_index Get index of which api has the name or the alias
print.pxweb_api_catalogue_entry Print a catalogue entry
build_pxweb_url Build the url to a PXWEB api
check_new_pxweb_apis Check and compare differences between remote and local api catalogue
calc_dim_type Calculates which dimensions that are used as row and col variables in data
get_pxweb_levels Get levels from API node
get_pxweb_metadata Get data
choose_pxweb_api Choose an api from api_catalogue
pxe_handle_input Handle a user input for a pxweb_explorer object.
pxe_input Get (allowed) inputs for a pxweb_input_allowed object.
pxe_position_variable_can_be_eliminated Can the variable at the current position be eliminated?
choose_pxweb_database_url Calculate a specific database to get data from
clean_pxweb Clean raw data from PX-WEB
pxe_print_download_code Print code to download query
as_pxweb_levels Assert that x is a correct pxweb_database_list object.
api_timer Creates a timer that keeps track of how many calls that has been called during a time period depending on the api configuration. If there can't be another call the function pauses R to do the call.
assert_pxweb_metadata Assert that x is a correct pxweb_metadata object.
pxe_interactive_get_data Ask to download and download data
get_api_list Get the api catalogue from json file
pxweb_database_list Construct a pxweb_database_list object.
download_pxweb Traverse node for query alternatives and download data.
assert_pxweb_query Assert a pxweb_query object
pxweb_add_metadata_to_query Add and remove metadata to query
pxe_back_position Move in the pxweb_explorer position
pxe_position_choice_size How many choices has the current position?
get_api_list_remote Get the api catalogue from github
pxe_allowed_input Defines allowed input for a position in a pxweb_explorer or character object.
pxweb_explorer Create a pxweb_explorer object.
findData.input Get input that is consistent with
pxe_position_is_api_catalogue Is the current position an api_catalogue position?
get_dim_size The function calculates the dimension of a query. That means the numberof categories for each variable downloaded
pxweb_add_call Add an api call to a pxweb_api_s3 object
pxweb_add_config Add the config slot to a pxweb object
pxweb_api_catalogue_entry Constructor for pxweb_api_catalogue_entry.
pxweb_advanced_get Do a GET call to PXWEB API for advanced users
get_github_api_urls Get (hard coded) api catalogue github urls
pxweb_get_api_test_data_frame Build api test data.frame
pxweb_api_name Get the api name, rootpath, subpath, path or dbpath
pxweb_interactive Find and download data interactively from a PXWEB API
http_was_redirected http_was_redirected
pxweb_http_log_on Setup a structure to log all API calls
interactive_pxweb Find and download data interactively from PX-WEB API
pxweb_clear_cache Clear cache of all (or one) pxweb object
pxweb S3 constructor for pxweb api object.
pxweb_query Create a PXWEB query
pxweb_query_as_json Convert a pxweb_query object to a json string
pxweb_get_data Do a GET call to PXWEB API and return a data.frame
pxweb_add_api_subpath Add the subpath slot to a pxweb path slot
pxweb_tempdir Setup temorary directory for the pxweb
pxweb_as_data_frame Coerce a pxweb_data object to a data.frame
pxweb_as_json Convert object to json
pxweb_data Construct a pxweb_data object.
assert_pxweb_data Assert that x is a correct pxweb_data object.
pxweb_data_column_comment Construct a pxweb_data_comment object
pxweb_data_comments Construct a pxweb_data_comments object.
pxweb_query_as_rcode Convert a pxweb_query object to R code
assert_pxweb_data_comments Assert that x is a correct pxweb_data_comments object.
calculate_data_dim The function calculates the dimension of a data object
pxweb_fix_url Fix url characters
pxweb_test_api Test a full or a part of a PXWEB api.
pxweb_get Do a GET call to PXWEB API
pxweb_query_dim Compue the dimension of the query
save_pxweb Save and load pxweb objects from R temp folder
pxweb_metadata_add_null_values Add values to NULL value variables in PXWEB metadata objects
pxweb_metadata_dim Compue the dimension of a metadata object
split_dimensions_left_right Split variables into chunks
str_pad Pad a string to a fixed size
pxweb_test_create_api_paths Create all paths from a list of pxweb_api_catalogue entries
str_trim Taken from trimws for reasons of compatibility with previous R versios.
test_pxweb_api_get_node_metadata Get metadata from all bottom nodes identified with test_pxweb_api_get_nodes.
pxweb_test_time_limit Test time limit object
pxweb_interactive_input Get input from user
pxweb_levels Construct a pxweb_levels object.
pxweb_metadata_elimination Get boolean vector
checkForLevels Function to silently test for existence of metadata and return TRUE or FALSE based on the result of that test.
pxweb_parse_response Parse the response from a PXWEB API
test_pxweb_api_get_nodes Get the whole node tree from a given pxweb api
create_batch_list The function takes an url and a dims object and calculates if this needs to be downloaded in batches due to download limit restrictions in the pxweb api. If '*' is used it will get the numberof values for this dimension using a get_pxweb_metadata call.
write_api_list Write api catalogue to json file
deparseLevels Functions from sweSCB package that are not called anywhere (yet) but might be useful later Function to deparse an URL into its components.
temp_api_file_path The path to store paths to api.json
permutations Generate permutations of dimensions to find optimal no of batches
print.api_parameters Print method for api_parameters.
temp_api_folder_path The path to the folder to store paths to api.json
pxe_position_is_full_query Is the current position a full query (i.e. choices for all metadata variables)?
pxe_position_is_metadata Is the current position a metadata object?
pxe_position_multiple_choice_allowed Are multiple choices allowed?
pxe_position_title Get the table title for the current position
pxweb_api-class A Reference Class to represent an pxweb_api
pxweb_api_catalogue Get the PXWEB API catalogue
pxweb_data_dim Compute the dimension of the query pxweb_data object
pxweb_data_jsonstat Construct a pxweb_data_jsonstat object.
pxweb_query_values Get query filter
pxweb_split_query Split query in optimal sub-queries
text_to_url Change text to url
update_pxweb_apis Download and update the PXWEB API catalogue
No Results!

Vignettes of pxweb

Name
d_example.rda
main.R
pxweb.Rmd
No Results!

Last month downloads

Details

Type Package
Encoding UTF-8
VignetteBuilder knitr
URL https://github.com/rOpenGov/pxweb/
BugReports https://github.com/rOpenGov/pxweb/issues
License BSD_2_clause + file LICENSE
RoxygenNote 6.1.0
NeedsCompilation no
Packaged 2019-01-07 18:11:32 UTC; mansmagnusson
Repository CRAN
Date/Publication 2019-01-07 19:00:17 UTC

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/pxweb)](http://www.rdocumentation.org/packages/pxweb)