I think your solution is more comfortable. But what do you do if an new entry 
consists of 4 children? How can you modify the old result of rbind()? Is ther a 
possibility to save the childrens ages in one table entry?

Thanks, Corinna
 

-----Ursprüngliche Nachricht-----
Von: Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 26. März 2007 15:38
An: Schmitt, Corinna
Cc: r-help@stat.math.ethz.ch
Betreff: Re: [R] Listing function

maybe it'd be better to use a data.frame(), e.g.,

dat <- data.frame(name = I("Fred"), wife = I("Mary"), no.children = 3,
cild.ages1 = 4, cild.ages2 = 7, cild.ages3 = 9)
##############
new.info <- c(name = "Barney", wife = "Liz", no.children=2,
cild.ages1 = 3, cild.ages2 = 5, cild.ages3 = NA)

rbind(dat, new.info)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Schmitt, Corinna" <[EMAIL PROTECTED]>
To: <r-help@stat.math.ethz.ch>
Sent: Monday, March 26, 2007 3:26 PM
Subject: [R] Listing function


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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

______________________________________________
R-help@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.

Reply via email to