Learn R Programming

pxweb (version 0.19.2)

R Interface to PXWEB APIs

Description

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.

Copy Link

Version

Install

install.packages('pxweb')

Monthly Downloads

1,040

Version

0.19.2

License

BSD_2_clause + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Mans Magnusson

Last Published

September 6th, 2026

Functions in pxweb (0.19.2)

pxe_allowed_input

Defines allowed input for a position in a pxweb_explorer or character object.
pxe_handle_input

Handle a user input for a pxweb_explorer object.
is_pxweb_query_selection

Test for PXWEB API v2 query selection helpers.
pxweb_add_mandatory_variables

Add mandatory variables to query
pxweb_data_dim

Compute the dimension of the query pxweb_data object
is_pxweb_config_response

Check if a response is a pxweb config response
pxd_values_to_valuetexts

Convert a pxweb data objects values to valuetext
assert_pxweb_query

Assert a pxweb_query object
print.pxweb_api_catalogue_entry

Print a catalogue entry
pxe_position_is_full_query

Is the current position a full query (i.e. choices for all metadata variables)?
pxweb_data_jsonstat

Construct a pxweb_data_jsonstat object.
pxweb_api_catalogue_entry

Constructor for pxweb_api_catalogue_entry.
assert_pxweb_query_v2

Assert a pxweb_query_v2 object.
http_was_redirected

http_was_redirected
pxweb_add_metadata_to_query

Add and remove metadata to query
pxe_input

Get (allowed) inputs for a pxweb_input_allowed object.
pxweb_api_name

Get the api name, rootpath, subpath, path or dbpath
generate_permutations

Generate batch permutations
pxe_interactive_get_data

Ask to download and download data
pxe_position_is_metadata

Is the current position a metadata object?
pxweb

S3 constructor for pxweb api object.
pxweb_as_json

Convert object to json
pxweb_data_v2_dataset_note_comment

Construct a v2 dataset note comment.
pxweb_data_v2_note_text

Normalize PXWEB API v2 note/status text.
pxweb_add_api_subpath

Add the subpath slot to a pxweb path slot
pxweb_levels

Construct a pxweb_levels object.
pxweb_interactive_input

Get input from user
pxweb_as_data_frame

Coerce a pxweb_data object to a data.frame
assert_query_can_be_split_to_batches

Assert that a given pxweb query can be split
assert_pxweb_url

Assert that the url structure is correct
assert_pxweb_data_jsonstat2

Assert that x is a PXWEB API v2 JSON-stat2 data response.
pxe_metadata_choices

Get and set pxe_metadata_coices
pxe_back_position

Move in the pxweb_explorer position
pxweb_codelists

List PXWEB API v2 codelists in metadata.
pxweb-package

Interface to PX-WEB APIs from R
pxweb_data_v2_column_comment

Construct a v2 dimension note comment.
pxweb_data_v2_c

Combine PXWEB API v2 data objects.
pxe_metadata_variable_names

Get the meta data variable names from a pxweb_explorer object.
pxe_print_download_code

Print code to download query
pxweb_get

Do a GET call to PXWEB API
pxweb_data_v2

Construct a pragmatic pxweb_data_v2 object.
pxweb_metadata

Construct a pxweb_metadata object.
pxe_position_variable_can_be_eliminated

Can the variable at the current position be eliminated?
pxweb_fix_url

Fix url characters
pxe_pxobj_at_position

Return the pxweb object at the current position
pxweb_data

Construct a pxweb_data object.
pxweb_metadata_dim

Compue the dimension of a metadata object
build_pxweb_url.url

Build the url to get the config from a PXWEB api
pxe_position_is_api_catalogue

Is the current position an api_catalogue position?
pxe_position_choice_size

How many choices has the current position?
assert_pxweb_database_list

Assert that x is a correct pxweb_database_list object.
pxweb_data_jsonstat2

Construct a pxweb_data_jsonstat2 object.
pxweb_metadata_add_null_values

Add values to NULL value variables in PXWEB metadata objects
pxweb_detect_version

Backend helpers for PXWEB APIs
pxweb_api_catalogue

Get the PXWEB API catalogue
pxweb_audit_api_catalogue_config

Audit PXWEB API catalogue config endpoints
pxweb_advanced_get

Do a GET call to PXWEB API for advanced users
pxweb_c

Combine pxweb objects
pxweb_query_as_json

Convert a pxweb_query object to a json string
pxweb_metadata_elimination

Get boolean vector
parse_url_or_fail

Parse a character string or throws error if it fails
pxweb_query_as_rcode

Print a pxweb_query object as R code
pxe_position_multiple_choice_allowed

Are multiple choices allowed?
pxweb_query_v2_request

Construct a PXWEB API v2 request object.
build_pxweb_rda_file_path

Build or get the tmp_rda_file_path from an url or pxweb_api_s3 object
permutations

Generate permutations of dimensions to find optimal no of batches
pxweb_search_url

Build the PXWEB search URL
pxweb_search_link

Extract a link URL from a PXWEB API v2 links list
pxweb_search_num

Extract a scalar numeric value from a list
pxweb_query_v2_has_codelist

Test whether a query variable uses a PXWEB API v2 codelist.
pxweb_explorer

Create a pxweb_explorer object.
pxweb_data_c

Combine pxweb objects
pxweb_search_v1_table_url

Build a PXWEB API v1 table URL from a search hit
pxweb_query_as_v2

Convert a pxweb_query object to a PXWEB API v2 query.
pxweb_query_dim

Compute the dimension of the query
pxweb_query_filter

Get query values
pxweb_query_values

Get query filter
pxweb_response_v2_output_format

Get the requested PXWEB API v2 output format from a response URL.
pxweb_metadata_v2_value_texts

Get value texts from a PXWEB API v2 dimension.
pxweb_metadata_v2_values

Get ordered values from a PXWEB API v2 dimension.
pxweb_v2_table_id

Extract a PXWEB API v2 table id.
pxweb_query_dim_splittable

Get vector indicating splittable variables
pxweb_v2_output_file_extension

Convert a PXWEB API v2 output format to a file extension.
pxweb_search

Search PXWEB API tables
pxweb_query_selection

Construct a PXWEB API v2 query selection helper.
pxweb_selection

Create a PXWEB query selection
pxweb_search_api_version

Detect the PXWEB API version used by a search URL
pxweb_database_list

Construct a pxweb_database_list object.
pxe_position_title

Get the table title for the current position
pxweb_data_colnames

Get query filter
pxweb_data_v2_value_comment

Construct a v2 category note comment.
pxweb_test_time_limit

Test time limit object
pxweb_tempdir

Setup temorary directory for the pxweb
pxweb_table_response_v2

Construct a table_response_v2 object.
pxweb_interactive

Find and download data interactively from a PXWEB API
pxweb_split_query

Split query in optimal sub-queries
pxweb_metadata_v2

Construct a pxweb_metadata object from a PXWEB API v2 metadata response.
pxweb_query_v2

Construct a pxweb_query_v2 object.
pxweb_search_chr

Extract a scalar character value from a list
pxweb_http_log_on

Setup a structure to log all API calls
pxweb_metadata_time

Get boolean vector
pxweb_search_parse_v1

Parse PXWEB API v1 search results
pxweb_query_selection_extra_query

Build codelist-related query parameters for a v2 selection helper.
pxweb_query_v2_selection_type

Get the PXWEB API v2 selection type for a query variable.
pxweb_query_value_as_v2

Convert one query value to a PXWEB API v2 selection fragment.
pxweb_query_v2_extra_query

Get PXWEB API v2 extra query parameters.
pxweb_v2_data_query_params

Build PXWEB API v2 data endpoint query parameters.
pxweb_add_call

Add an api call to a pxweb_api_s3 object
pxweb_search_empty_v1

Create an empty PXWEB API v1 search result
pxweb_search_trim_slash

Remove trailing slashes from a URL string
save_pxweb

Save and load pxweb objects from R temp folder
pxweb_search_response

Parse a PXWEB search response
split_dimensions_left_right

Split variables into chunks
pxweb_test_api

Test a full or a part of a PXWEB api.
pxweb_search_parse_v2

Parse PXWEB API v2 search results
pxweb_data_v2_obs_comment

Construct a v2 observation comment.
pxweb_data_comments

Construct a pxweb_data_comments object.
pxweb_clear_cache

Clear cache of all (or one) pxweb object
pxweb_cite

Cite a PXWEB data object
pxweb_get_data

Do a GET call to PXWEB API and return a data.frame
pxweb_get_api_test_data_frame

Build api test data.frame
str_pad

Pad a string to a fixed size
pxweb_data_v2_status_comments

Construct v2 status comments.
pxweb_data_column_comment

Construct a pxweb_data_comment object
pxweb_add_config

Add the config slot to a pxweb object
pxweb_test_create_api_paths

Create all paths from a list of pxweb_api_catalogue entries
pxweb_parse_response

Parse the response from a PXWEB API (advanced)
pxweb_query

Create a PXWEB query
str_trim

Taken from trimws for reasons of compatibility with previous R versios.
pxweb_query_helpers

PXWEB API v2 query helpers
pxweb_v2_data_request

Build a PXWEB API v2 data request.
pxweb_v2_data_value_codes_query

Build PXWEB API v2 value code query parameters.
pxweb_search_request

Do a PXWEB search GET request
pxweb_query_list_as_v2

Convert a named list to a PXWEB API v2 request.
pxweb_search_path_parts

Split a parsed URL path into parts
pxweb_v2_table_metadata_url

Build the PXWEB API v2 metadata URL for a table.
pxweb_validate_query_with_metadata

Validate a pxweb_query with a pxweb_metadata object
assert_pxweb_data

Assert that x is a correct pxweb_data object.
assert_pxweb_config

Assert that the config slot is correct
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_levels

Assert that x is a correct pxweb_levels object.
add_pxe_defaults

Add default values to pxe
assert_pxweb_calls

Assert that the rda_file_path is correct
api_catalogue

Defunct functions
assert_pxweb_data_comments

Assert that x is a correct pxweb_data_comments object.
as_pxweb_levels

Assert that x is a correct pxweb_database_list object.
assert_pxweb

Assert that the url structure is correct
assert_pxweb_input_allowed

Assert a pxweb_input_allowed object
assert_pxweb_api_catalogue

Assert a pxweb_api_catalogue object
assert_pxweb_rda_file_path

Assert that the rda_file_path is correct
assert_pxweb_table_response_v2

Assert that x is a correct pxweb_table_response_v2 object.
assert_pxweb_metadata

Assert that x is a correct pxweb_metadata object.
assert_pxweb_metadata_response_v2

Assert that x is a PXWEB API v2 metadata response.
build_pxweb_url

Build the url to a PXWEB api
build_pxweb_v2_api_subpath

Build the url to a PXWEB V2 API SUBPATH
pxe_data_url

Get the url to a table