error length > 1 and only the first element will be used?
I can't reproduce that error message, so I'm not sure what's going wrong.  That said, the typical way to filter a vector in R is to subset it with a conditional like so:

tst&lt;-c("","foo", "bar", "", "baz")
tst[tst!=""]
[1] "foo" "bar" "baz"