Re: [R] Removing multiple elements from a vector or list

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 2:30 PM, arun wrote: > Hi, > vec1<- letters alp <- as.list(letters) would have constructed the vector that was described. > vec1[!grepl("b|r|x",alp)] > # [1] "a" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "s" "t" > "u" > #[20] "v" "w" "y" "z" > vec1[!vec1

Re: [R] Removing multiple elements from a vector or list

2013-04-15 Thread arun
Hi,  vec1<- letters vec1[!grepl("b|r|x",alp)] # [1] "a" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "s" "t" "u" #[20] "v" "w" "y" "z"  vec1[!vec1%in% c("b","r","x") ] # [1] "a" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "s" "t" "u" #[20] "v" "w" "y" "z" alp<-lapp