Combining some of the suggestions, the best approach for my scenario is likely to be as follows. The reason I don't like the embedding of filter() in an if is because I have some filter from menu items of a brilliant application. Thus, manipulating a variable in the source saves a lot of input.
a <- c("UA") b <- if(length(a)>1) a else c(a,"") tbl(my_db, "dplyr") %>% filter(carrier %in% b)
or
a <- c("UA") varToFilterFor <- rep(a ,2) tbl(my_db, "dplyr") %>% filter(carrier %in% varToFilterFor)
source share