Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dplyr::group_by support #88

@geotheory

Description

@geotheory

Is this officially supported or just an unintended bonus?

require(padr)
#> Loading required package: padr
require(tidyverse)
#> Loading required package: tidyverse

df = tibble(day = as.Date(c('2022-05-02', '2022-05-09', '2022-05-23', '2022-05-04', '2022-05-18', '2022-05-25')),
            y = c(3, 4, 6, 8, 3, 5), grp = rep(c('A','B'), each = 3))

df |> 
  dplyr::group_by(grp) |> 
  pad(interval = 'week') |> 
  fill_by_value(y) |> 
  print() |> 
  ggplot(aes(day, y, col = grp)) + 
  geom_line() + geom_point()
#> # A tibble: 8 × 3
#> # Groups:   grp [2]
#>   day            y grp  
#>   <date>     <dbl> <chr>
#> 1 2022-05-02     3 A    
#> 2 2022-05-09     4 A    
#> 3 2022-05-16     0 A    
#> 4 2022-05-23     6 A    
#> 5 2022-05-04     8 B    
#> 6 2022-05-11     0 B    
#> 7 2022-05-18     3 B    
#> 8 2022-05-25     5 B

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions