[R] Names in vector occurring in another vector
Leeds, Mark (IED)
Mark.Leeds at morganstanley.com
Mon Apr 16 20:20:24 CEST 2007
I have a vector of character strings such as
mainnames<-c("CAD","AUD") and another vector say
checknames<-c("CAD.l1","AUD.l1","JPY.l1","EUR.l1","CAD.l2","AUD.l2","JPY
.l2","EUR.l2")
I want a new vector of character strings that is just
resultnames<-c("JPY.l1","EUR.l1","JPY.l2","EUR.l2")
Because any time a name occurs in checknames that has a subset that
matches with mainnames, the
name in checknames should not be in the final result !!!!!!!!!!!!!!!!!
I can't use %in% because this example doesn't require exact matching.
The general problem would always have an "el after the dot but the
numbers can go upto double digits.
Thanks a lot.
mark
--------------------------------------------------------
This is not an offer (or solicitation of an offer) to buy/se...{{dropped}}
More information about the R-help
mailing list