Skip to contents

Some basic dplyr functions are re-implemented here for for fr_tdr objects. The input is converted with as.data.frame() before being passed to the dplyr function. The resulting tibble object is converted back into a fr_tdr object, matching table- and field-specific metadata where possible by using as_fr_tdr() and specifying the .template argument.  

dplyrfr
mutate()fr_mutate()
rename()fr_rename()
select()fr_select()
filter()fr_filter()
summarise()fr_summarise()
arrange()fr_arrange()

Usage

fr_mutate(x, ...)

fr_rename(x, ...)

fr_select(x, ...)

fr_filter(x, ...)

fr_summarize(x, ...)

fr_arrange(x, ...)

Arguments

x

a fr_tdr object

...

passed to the underlying dplyr function

Value

a fr_tdr object

Examples

read_fr_tdr(fs::path_package("fr", "hamilton_poverty_2020")) |>
  fr_mutate(next_year = year + 1) |>
  fr_rename(new_year = next_year) |>
  fr_select(-new_year) |>
  fr_filter(fraction_poverty > 0.1) |>
  fr_summarize(median_poverty_fraction = median(fraction_poverty)) |>
  fr_arrange(median_poverty_fraction)
#> hamilton_poverty_2020
#> - version: 0.0.1
#> - title: Hamilton County Poverty Rates in 2020
#> # A tibble: 1 × 1
#>   median_poverty_fraction
#>                     <dbl>
#> 1                   0.216