Re: [R] Extracting index in character array.

2010-10-13 Thread Christian Raschke

> which(list=="C")
[1] 3


See ?which


On 10/13/2010 11:56 AM, lord12 wrote:

If I have a character array:

list = c("A", "B", "C")

how do I access the third element without doing list[3]. Can't I find the
index of "C" using a particular function?
   



--
Christian Raschke
Department of Economics
and
ISDS Research Lab (HSRG)
Louisiana State University
Patrick Taylor Hall, Rm 2128
Baton Rouge, LA 70803
cras...@lsu.edu

__
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.


[R] Extracting index in character array.

2010-10-13 Thread lord12

If I have a character array:

list = c("A", "B", "C")

how do I access the third element without doing list[3]. Can't I find the
index of "C" using a particular function? 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Extracting-index-in-character-array-tp2994029p2994029.html
Sent from the R help mailing list archive at Nabble.com.

__
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.