variables()
works like the "Variables" tab in Stata.variables_search()
searches for variables by name or label.
Arguments
- .data
The input data (data frame or tibble).
- ...
<
tidy-select
> or <data-masking
> Variables to include in the codebook. This argument can be omitted.- string
A string to search for in the variable names or labels.
Examples
variables(lifeexp)
#> # A tibble: 6 × 2
#> name label
#> <chr> <chr>
#> 1 region Region
#> 2 country Country
#> 3 popgrowth Avg. annual % growth
#> 4 lexp Life expectancy at birth
#> 5 gnppc GNP per capita
#> 6 safewater Safe water
variables_search(lifeexp, "n")
#> # A tibble: 3 × 2
#> name label
#> <chr> <chr>
#> 1 region Region
#> 2 country Country
#> 3 gnppc GNP per capita