Open moodymudskipper opened 4 years ago
or can we use a binary ?
there ?
fish_encounters %tb>% .[`{station}` = seen ? 0, .by = "fish"]
This way we can use it also with at
/if
features :
iris %>% .[(?"^Sepal" = .?0]
will replace in all columns starting by Sepal
the missing values by 0
We could use a simple %NA%
operator in the latter case though, but ?
is necessary for gather
, unless we have an .expand
param. Moreover ?
has better precedence, but we'll have to deal with :=
for precedence.
done
Reopening to add a feature.
We can be more flexible and allow the value to be a function to be applied, or a dot expression. We should also support the "along" formula notation here.
This way we can have fill = locf
, fill = list(a = nocb, b = mean(., na.rm = TRUE) ~ mygrp)
This way we can do advanced imputation easily.
maybe check MICE package to see if we can do more
to support dotted expression we'll need to introduce funs()
which should return a list of quoted expression with a class, then check the calls before applying.
it will behave like the
replace
argument oftidyr::replace_na()
or thevalues_fill
argument ofpivot_wider()
.if a single value is given, all
NAs
are replaced, if a list is given, or a selection, we replace the given variables.