Skip to content

fill() not replacing NAs when value type is period #1094

@joeycouse

Description

@joeycouse

I've noticed fill() does not support value type period. I didn't see anything in the documentation mentioning this case or any warnings that certain values couldn't be filled.

library(tidyverse)
library(lubridate)
#> 
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#> 
#>     date, intersect, setdiff, union

set.seed(24)

n <- 2

df <- tibble(
  my_type = sample('a', n, replace = T),
  time = period(12, units = 'second'),
  value = sample(c(NA, 5), n, replace = F)
)

df[2,2] = NA

df
#> # A tibble: 2 x 3
#>   my_type time     value
#>   <chr>   <Period> <dbl>
#> 1 a       12S          5
#> 2 a       NA          NA

df %>%
  group_by(my_type) %>%
  fill(everything(), .direction = 'down')
#> # A tibble: 2 x 3
#> # Groups:   my_type [1]
#>   my_type time     value
#>   <chr>   <Period> <dbl>
#> 1 a       12S          5
#> 2 a       NA           5

Created on 2021-02-18 by the reprex package (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviormissing values 💀

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions