Skip to contents

Search a Kolada KPI Group metadata table. Only keep rows that contain the search query. Searches group titles and group IDs. Note that this function does not search for individual KPIs contained within KPI groups! To search for KPIs within a KPI group, see examples below for an example using kpi_grp_unnest.

Usage

kpi_grp_search(kpi_grp_df, query)

Arguments

kpi_grp_df

A Kolada KPI Group metadata table, as created by e.g. get_kpi_groups.

query

A search term or a vector of search terms to filter by. Case insensitive.

Value

A Kolada KPI Group metadata table

Examples

if (kolada_available()) {
kpi_grp_df <- get_kpi_groups()

# Which KPI groups match the keyword "ekonomi" (economy)?
kpi_grp_df %>% kpi_grp_search("ekonomi")

# Which KPI groups contain KPIs matching the keyword "arbete" (work/labour)?
kpi_grp_df %>%
  kpi_grp_unnest() %>%
  kpi_search("arbete") %>%
  dplyr::count(group_title, sort = TRUE)
}
#> # A tibble: 31 × 2
#>    group_title                                   n
#>    <chr>                                     <int>
#>  1 Personalnyckeltal                            11
#>  2 Elevenkät årskurs 5                           8
#>  3 Elevenkät årskurs 8                           8
#>  4 Elevenkäten år 2                              8
#>  5 Enhet elevenkät år 2 på gymnasiet             8
#>  6 Enhet elevenkät årskurs 5                     8
#>  7 Enhet elevenkät årskurs 8                     8
#>  8 Medborgarundersökningen                       8
#>  9 Nationella trygghetsundersökningen            8
#> 10 Pedagogisk personal enkät - Gymnasieskola     7
#> # ℹ 21 more rows