Hi everybody, I have the following problem. I have a vector containing character elements, such as:
list = c("aa","bb","cc","dd","ee") I want to create an index which identifies the elements that are different from, e.g. "aa" and "bb". When I do the following: jj = list!="aa" & list!="bb" > jj [1] FALSE FALSE TRUE TRUE TRUE I do the job. But I wonder whether there is a shorter command to compare the elements of 'list' directly to both "aa" and "bb", avoiding the repetition of '& list!=...' and get a result such as jj thanks! -- Andrea Mario Lavezzi currently visiting the University of Oxford, Nuffield College Dipartimento Studi su Politica, Diritto e Società Piazza Bologni 8 90134 Palermo, Italy tel. ++39 091 23892208 fax ++39 091 6112023 skype: lavezzimario email: lave...@unipa.it web: http://www.unipa.it/~lavezzi [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.