View source: R/statswales_get_topic.R
| statswales_get_topic | R Documentation |
Returns sub-topics or datasets tagged directly to a given topic. Use
statswales_list_topics() to discover topic IDs.
statswales_get_topic(
topic_id,
lang = "en-gb",
page_number = 1,
page_size = 100,
sort_by = NULL
)
topic_id |
A numeric topic ID. Use |
lang |
Language for returned text. One of |
page_number |
Page number to return. Default |
page_size |
Number of results per page. Default |
sort_by |
Optional sort order for datasets under a leaf topic. Either a
string in |
The returned list has four fields:
selectedTopicDetails of the requested topic.
childrenSub-topics under this topic. Empty for leaf topics.
parentsAncestor topics from root to the selected topic.
datasetsA list with data (dataset list items) and count.
Only populated for leaf topics (those with no children).
A list with fields selectedTopic, children, parents, and
datasets. Returns NULL if the request fails.
## Not run:
topics <- statswales_list_topics()
topic <- statswales_get_topic(topics$id[1])
# Sub-topics (non-leaf)
topic$children
# Datasets at a leaf topic
topic$datasets$data
topic$datasets$count
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.