I have now rewriten my problem to make it clearer
I want to replace a condition like this where var is a variable in dataframe (dataframe$var) with a paste or other solution as I do have so many condition values(?) (a, b and c in my example).
subdataframe<-dataframe[var=="a"|var=="b"|var=="c",]
I have tried to make a list(?) of the condtion values.
sample<-c("a","b","c")
And to then use paste to make the logical condition
subdataframe<-dataframe[paste("var",sample,sep="==",collapse="|"),]
But that doesn’t work
Help please =)
Marcus
Heed fortune(106):
So I would encourage you to rethink what you’re trying to do…
I would guess that you could use
matchor%in%to achieve your desired result, but you haven’t told us what you’re trying to do.