Ptit_Bleu
2007-Aug-31 08:17 UTC
[R] Problem of vocabulary : retrieve element of a list of a list
Hi, I read the posts for 2 hours and ?list and tried many comninations but I haven't found the answer to this basic question. So I decided to post my question even if it is a silly one ... What is the instruction to retrieve, for example, the "D" of the first list ? Thanks in advance, Ptit Bleu.> x<-list(LETTERS[1:5], LETTERS[10:20]) > x[[1]] [1] "A" "B" "C" "D" "E" [[2]] [1] "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" -- View this message in context: http://www.nabble.com/Problem-of-vocabulary-%3A-retrieve-element-of-a-list-of-a-list-tf4358872.html#a12422479 Sent from the R help mailing list archive at Nabble.com.
Felix Andrews
2007-Aug-31 08:43 UTC
[R] Problem of vocabulary : retrieve element of a list of a list
x[[1]][4] On 8/31/07, Ptit_Bleu <ptit_bleu at yahoo.fr> wrote:> Hi, > > I read the posts for 2 hours and ?list and tried many comninations but I > haven't found the answer to this basic question. So I decided to post my > question even if it is a silly one ... > > What is the instruction to retrieve, for example, the "D" of the first list > ? > Thanks in advance, > Ptit Bleu. > > > > x<-list(LETTERS[1:5], LETTERS[10:20]) > > x > [[1]] > [1] "A" "B" "C" "D" "E" > > [[2]] > [1] "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" > > -- > View this message in context: http://www.nabble.com/Problem-of-vocabulary-%3A-retrieve-element-of-a-list-of-a-list-tf4358872.html#a12422479 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Felix Andrews / ??? PhD candidate Integrated Catchment Assessment and Management Centre The Fenner School of Environment and Society The Australian National University (Building 48A), ACT 0200 Beijing Bag, Locked Bag 40, Kingston ACT 2604 http://www.neurofractal.org/felix/ voice:+86_1051404394 (in China) mobile:+86_13522529265 (in China) mobile:+61_410400963 (in Australia) xmpp:foolish.android at gmail.com 3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8
jiho
2007-Aug-31 08:51 UTC
[R] Problem of vocabulary : retrieve element of a list of a list
On 2007-August-31 , at 10:17 , Ptit_Bleu wrote:>> x<-list(LETTERS[1:5], LETTERS[10:20])not sure to have understood exactly what you meant. if you want to search for the D in the list: lapply(x,charmatch,"D") should get you started. if you just want to know the syntax to extract an element from a list x[[1]][4] will get you the "D". but I a sure you would have found out if you read the manual carefully. maybe you should read an R introduction and practice on the examples there rather than go straight into your own data. It would take a week at most and is very rewarding in the long term. An introduction in english: http://cran.r-project.org/doc/manuals/R-intro.pdf A nice one in French http://www.cran.r-project.org/doc/contrib/Paradis-rdebuts_fr.pdf Cheers, JiHO --- http://jo.irisson.free.fr/
Possibly Parallel Threads
- Sweave : change value in rnw file to generate multiple "single" reports ?
- Must be easy, but haven't found the function (numerical integration)
- Best way to select good points in a noisy signal ?
- find a sequence of characters in a vector
- Friendly way to link R - MySQL and non-(R and Mysql) users ?