I'm trying to do something like
df[<very-long-and-complicated-selection>,]$foo <- "bar"
This works well if there are lines matching the selection.
If not, I get an error
Error in $<-.data.frame ( *tmp* , "foo", value = "bar"):
replacement has 1 row, data has 0
However, my code is designed in such a way that a match is not possible.
Is there a clean, short, and simple solution to avoid these (and only these) errors?
source share