[R] how to initial a list to store data result?

Bill.Venables at csiro.au Bill.Venables at csiro.au
Tue Jun 22 02:22:29 CEST 2010


The usual method is either

lis <- vector("list")

or, nearly equivalently,

lis <- list()

If you know in advance how many components the list will have, there can be a slight advantage in using 

lis25 <- vector("list", 25)

if e.g. you know the list will be of length 25.

Bill Venables.

 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of song song
Sent: Tuesday, 22 June 2010 9:18 AM
To: r-help at r-project.org
Subject: [R] how to initial a list to store data result?

May I ask how to initialize a list?

usually I will use " result=list(0) "  to do this. is this right?

	[[alternative HTML version deleted]]

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



More information about the R-help mailing list