Search a Kolada Organizational Unit metadata table. Only keep rows that
contain the search query. Matches against all columns or columns named
with the column
parameter. For more precise matching, please use
dplyr::filter
.
ou_search(ou_df, query, column = NULL)
A Kolada Organizational Unit metadata table, as created by e.g.
get_municipality
.
A search term or a vector of search terms to filter by. Case insensitive.
(Optional) A string or character vector with the names of
columns in which to search for query
.
A Kolada Organizational Unit metadata table
# Search for all OUs matching the search term "skola" (school)
# (skip the parameter "max_results" to actually download all data)
ou_df <- get_ou(max_results = 100)
ou_search(ou_df, "skola")
#> # A tibble: 54 × 4
#> id title municipality municipality_id
#> <chr> <chr> <chr> <chr>
#> 1 V11E0114123460 EDS FÖRSKOLA Upplands Vä… 0114
#> 2 V11E0114123464 FÖRSKOLAN OMVÄRLDEN Upplands Vä… 0114
#> 3 V11E0114123465 FÖRSKOLAN REGNBÅGEN Upplands Vä… 0114
#> 4 V11E0114123466 FÖRSKOLAN SKOGSTORP Upplands Vä… 0114
#> 5 V11E0114123467 FÖRSKOLAN SKUTAN Upplands Vä… 0114
#> 6 V11E0114123468 FÖRSKOLAN SOLKATTEN Upplands Vä… 0114
#> 7 V11E0114123469 FÖRÄLDRAKOOPERATIVA FÖRSKOLAN SE… Upplands Vä… 0114
#> 8 V11E0114123482 STALLETS FÖRSKOLA Upplands Vä… 0114
#> 9 V11E0114123483 SVERIGEFINSKA FÖRSKOLAN Upplands Vä… 0114
#> 10 V11E0114223002 ENGELSKA SKOLANS FÖRSKOLAN Upplands Vä… 0114
#> # … with 44 more rows
# Only keep OU entities matching "skola" but not "förskola" (preschool)
# located in Gothenburg municipality and starting with an "A" using
# regex matching
ou_filter <- get_ou(municipality = "1480") %>%
ou_search("^A", column = "title") %>%
ou_search("[^(för)]skola")