wdi_search | R Documentation |
This function searches for specified keywords across columns in a data frame and returns only the rows where at least one keyword appears in any of the specified columns. It supports nested columns (lists within columns) and provides the option to limit the search to specific columns.
wdi_search(data, keywords, columns = NULL)
data |
A data frame to search. It can include nested columns (lists within columns). |
keywords |
A character vector of keywords to search for within the specified columns. The search is case-insensitive. |
columns |
Optional. A character vector of column names to limit the
search to specific columns. If |
A data frame containing only the rows where at least one keyword is
found in the specified columns. The returned data frame has the same
structure as data
.
# Download indicators
indicators <- wdi_get_indicators()
# Search for keywords "inequality" or "gender" across all columns
wdi_search(
indicators,
keywords = c("inequality", "gender")
)
# Search for keywords only within the "indicator_name" column
wdi_search(
indicators,
keywords = c("inequality", "gender"),
columns = c("indicator_name")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.