Skip to contents

Searches table titles in the catalogue (see nso_tables()), case-insensitively, in English and Mongolian by default. query is a regular expression unless fixed = TRUE.

Usage

nso_search(
  query,
  sector = NULL,
  fields = c("tbl_eng_nm", "tbl_nm"),
  fixed = FALSE,
  live = FALSE
)

Arguments

query

Search string (regex, case-insensitive).

sector

Optional sector or sub-sector path (an id from nso_sectors() or nso_subsectors()); only tables in it or its sub-folders are searched.

fields

Character vector of fields to search within.

fixed

If TRUE, match query literally instead of as a regular expression, so characters such as + or ( need no escaping.

live

Use the live PXWeb keyword search instead of the bundled title index. The source's search semantics apply; regex matching and fields apply only to the local index. Results carry a catalogue attribute identifying the returned search window. Requires network access.

Value

Tibble of matching tables.

Examples

nso_search("population")
#> # A tibble: 71 × 9
#>    px_path     px_file tbl_id tbl_eng_nm tbl_nm strt_prd end_prd updated list_id
#>    <chr>       <chr>   <chr>  <chr>      <chr>  <chr>    <chr>   <chr>   <chr>  
#>  1 Education,… DT_NSO… DT_NS… NEW CASES… ХОРТ … 2000     2025    2026-0… Educat…
#>  2 Education,… DT_NSO… DT_NS… DEATHS OF… ХОРТ … 1990     2025    2026-0… Educat…
#>  3 Education,… DT_NSO… DT_NS… NEW CASES… ХОРТ … 2010     2025    2026-0… Educat…
#>  4 Education,… DT_NSO… DT_NS… INPATIENT… ЭМНЭЛ… 2017     2025    2026-0… Educat…
#>  5 Historical… DT_NSO… DT_NS… NUMBER OF… ХӨДӨЛ… 1965     1992    2025-1… Histor…
#>  6 Historical… DT_NSO… DT_NS… POPULATIO… НИЙТ … 1900     1992    2025-1… Histor…
#>  7 Historical… DT_NSO… DT_NS… NATURAL I… 1000 … 1935     1992    2025-0… Histor…
#>  8 Historical… DT_NSO… DT_NS… SOCIAL ST… ХҮН А… 1925     1992    2025-1… Histor…
#>  9 Historical… DT_NSO… DT_NS… MARRIAGES… 1000 … 1970     1992    2025-0… Histor…
#> 10 Historical… DT_NSO… DT_NS… DIVORCES … 1000 … 1970     1992    2025-0… Histor…
#> # ℹ 61 more rows
nso_search("infant mortality", sector = "Education, health")
#> # A tibble: 6 × 9
#>   px_path      px_file tbl_id tbl_eng_nm tbl_nm strt_prd end_prd updated list_id
#>   <chr>        <chr>   <chr>  <chr>      <chr>  <chr>    <chr>   <chr>   <chr>  
#> 1 Education, … DT_NSO… DT_NS… NUMBER OF… НЯЛХС… 2016-01  2026-08 2026-0… Educat…
#> 2 Education, … DT_NSO… DT_NS… NUMBER OF… НЯЛХС… 2010     2025    2026-0… Educat…
#> 3 Education, … DT_NSO… DT_NS… INFANT MO… НЯЛХС… 2010     2025    2026-0… Educat…
#> 4 Education, … DT_NSO… DT_NS… INFANT MO… НЯЛХС… 2010     2025    2026-0… Educat…
#> 5 Education, … DT_NSO… DT_NS… INFANT MO… НЯЛХС… 2016-01  2026-08 2026-0… Educat…
#> 6 Education, … DT_NSO… DT_NS… INFANT MO… НЯЛХС… 2010     2025    2026-0… Educat…
nso_search("c++", fixed = TRUE)
#> # A tibble: 0 × 9
#> # ℹ 9 variables: px_path <chr>, px_file <chr>, tbl_id <chr>, tbl_eng_nm <chr>,
#> #   tbl_nm <chr>, strt_prd <chr>, end_prd <chr>, updated <chr>, list_id <chr>