[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] Find value in vector (or matrix)
From:       Philipp Pagel <p.pagel () gsf ! de>
Date:       2003-11-20 12:46:59
[Download RAW message or body]

On Thu, Nov 20, 2003 at 01:26:23PM +0100, Pascal A. Niklaus wrote:
> Is there a function to check if a particular value is contained in a 
> vector?

> myvec <- c('foo','bar','duh','bonk')
> 'bonk' %in% myvec
[1] TRUE
> 'asdf' %in% myvec
[1] FALSE

> Also, is there a way to generate character sequences similar to numeric 
> sequences, e.g. something like "A":"J" ?

> LETTERS[1:5]
[1] "A" "B" "C" "D" "E"

> letters[c(8,9,12,23)]
[1] "h" "i" "l" "w"

cu
	Philipp

-- 
Dr. Philipp Pagel                                Tel.  +49-89-3187-3675
Institute for Bioinformatics / MIPS              Fax.  +49-89-3187-3585
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
85764 Neuherberg, Germany


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic