[R] lists

Hotz, T. th50 at leicester.ac.uk
Wed Jul 9 15:14:43 CEST 2003


> my.list<-list(a=1,b=2)
> length(my.list)
[1] 2
> my.list$c<-3
> my.list[[length(my.list)+1]]<-4
> my.list
$a
[1] 1

$b
[1] 2

$c
[1] 3

[[4]]
[1] 4

HTH

Thomas

---

Thomas Hotz
Research Associate in Medical Statistics
University of Leicester
United Kingdom

Department of Epidemiology and Public Health
22-28 Princess Road West
Leicester
LE1 6TP
Tel +44 116 252-5410
Fax +44 116 252-5423

Division of Medicine for the Elderly
Department of Medicine
The Glenfield Hospital
Leicester
LE3 9QP
Tel +44 116 256-3643
Fax +44 116 232-2976


> -----Original Message-----
> From: Aurora [mailto:aurora at ebi.ac.uk]
> Sent: 09 July 2003 12:56
> To: R-help at stat.math.ethz.ch
> Subject: [R] lists
> 
> 
> Is there a command similar to "dim" for lists, so that one 
> can know how 
> many elements it stores?
> Is it possible to add elements to a list once it has been constructed?
> 
> Thanks in advance,
> 
>         Aurora
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>




More information about the R-help mailing list