Description Usage Arguments Details Value
fetch_table
sends a query to the table endpoint and returns the
response as a list containing the results. The results include a dataframe
of tidy data for each measure requested by the query.
1 | fetch_table(query, filename = NULL, custom = NULL)
|
query |
Stat-Xplore query as a string. |
filename |
The path to a text file containing a Stat-Xplore query.
This argument is not required but has priority: if a |
custom |
A named list of character vectors. Each name/value pair indicates the item labels to use for the field with the given name when constructing the results dataframes. It is necessary to specify item labels explicitly using this argument when your query uses custom aggregate variables, as the number of variables in the results will not agree with the number of variables shown in the metadata. |
A query can be provided as a string or can be loaded from a file using the
filename
argument. This is sometimes convenient as Stat-Xplore
queries can be large and are most easily produced using the table builder
tool on the website, which exports queries as json text files.
Stat-Xplore returns one set of results for each measure included in a query. Each set of results includes data for different measures on the same set of observations.
The list of results has the following structure:
measures - the names of the measures for each dataset (character) fields - the names of categorical variables included in the data (character) items - the names of the categories or levels within each field (list) uris - the uris of the categories or levels within each field (list) dfs - a dataframe for each measure with the data in long form (list)
A list containing the results of the query, with one item per cube.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.