CH,
How about any:
any("Tiger" == animal)
The function which will tell you the index if any match
which("Tiger" == animal.
You should also look at the match funciton.
Dave
From:
"C.H."
To:
R-help
Date:
12/13/2010 08:50 AM
Subject:
[R] check for item
Hi CH,
Check
?is.element
?"%in%"
HTH,
Jorge
On Mon, Dec 13, 2010 at 9:48 AM, C.H. <> wrote:
> Dear R users,
>
> Suppose I have an vector like this:
>
> animal <- c("Tiger","Panda")
>
> I would like to know is there any function that check for the
> existence of certain item in a vector.
>
> e
Hi,
See ?"%in%" or ?match
animal <- c("Tiger","Panda")
"Tiger" %in% animal
[1] TRUE
"Acacia" %in% animal
[1] FALSE
"Panda" %in% animal
[1] TRUE
HTH,
Ivan
Le 12/13/2010 15:48, C.H. a écrit :
Dear R users,
Suppose I have an vector like this:
animal<- c("Tiger","Panda")
I would like to know i
Dear R users,
Suppose I have an vector like this:
animal <- c("Tiger","Panda")
I would like to know is there any function that check for the
existence of certain item in a vector.
e.g.
> func("Tiger",animal) # check for the existence of "Tiger"
TRUE
> func("Acacia",animal) #Acacia is not an i
4 matches
Mail list logo