[R] vector

Göran Broström gb at tal.stat.umu.se
Mon Dec 27 11:39:34 CET 2004


On Mon, Dec 27, 2004 at 11:09:13AM +0100, BXC (Bendix Carstensen) wrote:
> If you have all your vectors in a list
> 
> vl <- list( p1, p2, p3)
> 
> the the following should do the trick:
> 
> res <- numeric(0)
> for( i in 1:length(vl) ) res <- c( res, vl[[i]] ) 

or, shorter, and faster I would guess,

res <- unlist(v1)


> Bendix Carstensen
> ----------------------
> Bendix Carstensen
> Senior Statistician
> Steno Diabetes Center
> Niels Steensens Vej 2
> DK-2820 Gentofte
> Denmark
> tel: +45 44 43 87 38
> mob: +45 30 75 87 38
> fax: +45 44 43 07 06
> bxc at steno.dk
> www.biostat.ku.dk/~bxc
> ----------------------
> 
> > -----Original Message-----
> > From: r-help-bounces at stat.math.ethz.ch 
> > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Frederic renaud
> > Sent: Monday, December 27, 2004 1:57 AM
> > To: r-help at stat.math.ethz.ch
> > Subject: [R] vector
> > 
> > 
> > Hi!
> > Can you help me? I would like to make a vector from p 
> > pre-determined vector. The parameter p can change. I've try 
> > with ?c with unsuccess! An idee?
> > 
> > Sorry for my english!
> > Thanks
> > Fred
> > 
> > ______________________________________________
> > 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
> >
> 
> ______________________________________________
> 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

-- 
 Göran Broström                    tel: +46 90 786 5223
 Department of Statistics          fax: +46 90 786 6614
 Umeå University                   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden             e-mail: gb at stat.umu.se




More information about the R-help mailing list