[R] Change array size

Liaw, Andy andy_liaw at merck.com
Fri Feb 14 12:20:13 CET 2003


Is the following what you want?

> x<- rnorm(800)
> xt <- x[1:2^trunc(log(length(x),base=2))]
> length(xt)
[1] 512

HTH,
Andy

> -----Original Message-----
> From: Poizot Emmanuel [mailto:poizot at cnam.fr]
> Sent: Friday, February 14, 2003 4:52 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Change array size
> 
> 
> Hi,
> I would like to know if there is a way to change a vector of 
> arbitrary size
> to make it fits the nearest upper size multiple of a power of 2.
> 
> -- 
> Cordialy
> ----------------------------------------
> Emmanuel POIZOT
> Cnam/Intechmer
> Digue de Collignon
> 50110 Tourlaville
> Tél : (33)(0)2 33 88 73 42
> Fax : (33)(0)2 33 88 73 39
> -----------------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


------------------------------------------------------------------------------




More information about the R-help mailing list