Re: [R] test if text is part of vector

2012-01-20 Thread R. Michael Weylandt
; Von: Rainer M Krug >> An: Johannes Radinger >> CC: R-help@r-project.org >> Betreff: Re: [R] test if text is part of vector > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 20/01/12 12:50, Johannes Radinger wrote: >>> Hello,

Re: [R] test if text is part of vector

2012-01-20 Thread Johannes Radinger
Hi, thank you very much... %in% is the operator I was looking for. cheers, johannes Original-Nachricht > Datum: Fri, 20 Jan 2012 13:01:54 +0100 > Von: Rainer M Krug > An: Johannes Radinger > CC: R-help@r-project.org > Betreff: Re: [R] test if text is

Re: [R] test if text is part of vector

2012-01-20 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 20/01/12 12:50, Johannes Radinger wrote: > Hello, > > this is a very simple question: How can I find out if a word is > part of a list of words > > like: a <- "word1" b <- "word4" > > vector <- c("word1","word2","word3") > > I tried it with matc

Re: [R] test if text is part of vector

2012-01-20 Thread Petr PIKAL
Hi > Hello, > > this is a very simple question: > How can I find out if a word is part of a list of words > > like: > a <- "word1" > b <- "word4" > > vector <- c("word1","word2","word3") > > I tried it with match(a,vector) > but this gives the position of the word. > Perhaps a %in% vector

[R] test if text is part of vector

2012-01-20 Thread Johannes Radinger
Hello, this is a very simple question: How can I find out if a word is part of a list of words like: a <- "word1" b <- "word4" vector <- c("word1","word2","word3") I tried it with match(a,vector) but this gives the position of the word. I am not sure if and how that can be done with a logical