complete() raises an error when a value for a column to expand is of length zero. The reason for this is that expand() returns NULL resp. a 0 x 0 tibble for a length zero value.
In my opinion it would be better for expand() to return a dataframe/tibble with the same column specification as the original one (or raise a more informative error). This would also fix the problem with complete().
tidyr::complete(data.frame(a = character()), a = NULL)
#> Error in UseMethod("left_join"): no applicable method for 'left_join' applied to an object of class "NULL"
tidyr::expand(data.frame(a = character()), a = NULL)
#> NULL
tidyr::expand(tibble::tibble(a = character()), a = NULL)
#> # A tibble: 0 x 0
complete()raises an error when a value for a column to expand is of length zero. The reason for this is thatexpand()returns NULL resp. a 0 x 0 tibble for a length zero value.In my opinion it would be better for
expand()to return a dataframe/tibble with the same column specification as the original one (or raise a more informative error). This would also fix the problem withcomplete().