Reading docs here for complete()
fill:
A named list that for each variable supplies a single value to use
instead of NA for missing combinations.
Example priovided:
df %>%
complete(
group,
nesting(item_id, item_name),
fill = list(value1 = 0, value2 = 99)
My question is, can I tell complete to fill all with 0? Tried just fill = 0 which returned an error. I have more than 100 cols!
>Solution :
in the case you want to fill all columns,
library(dplyr)
library(tidyr)
df %>%
complete(
group,
nesting(item_id, item_name),
fill = across(everything(), ~0)
)