[R] Listing function

Michael T. Mader m.mader at gsf.de
Mon Mar 26 15:32:06 CEST 2007


Lst <- list()
Lst[[1]] <- list(name="Fred", wife="Mary", no.children=3, 
cild.ages=c(4,7,9))
Lst[[2]] <- list(name="Barney", wife="Liz", no.children=2, cild.ages=c(3,5))

I.e. a list of lists

Regards

Michael

Schmitt, Corinna wrote:
> Hallo,
> 
> I build a list by the following way:
> 
> Lst = list(name="Fred", wife="Mary", no.children=3, cild.ages=c(4,7,9))
> 
> I know how I can extract the information one by one. But now I want to
> add a new entry which looks like
> 
> name="Barney", wife="Liz", no.children=2, cild.ages=c(3,5)
> 
> How can I add this information to Lst without overwriting the first
> entry?
> How can I then extract the corresponding information if I have both
> entries in Lst?
> 
> Thanks for helping,
> 
> Corinna
> 
> ______________________________________________
> 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.
> 

-- 
Michael T. Mader
Institute of Stem Cell Research
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
D-85764 Neuherberg
0049-89-3187-3683

Program testing can be quite effective for showing the presence of bugs, 
but is hopelessly inadequate for showing their absence.
	E. W. Dijkstra



More information about the R-help mailing list