"Liaw, Andy" <[EMAIL PROTECTED]> writes:

> Is the following what you want?
> 
> > x<- rnorm(800)
> > xt <- x[1:2^trunc(log(length(x),base=2))]
> > length(xt)
> [1] 512

I don't think so (notice "upper"). More likely

x <- rnorm(800)
l <- length(x)
xt <- c(x,numeric(2^ceiling(log(l,base=2))-l))
length(xt) # 1024

but "fits" might also imply interpolation?

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


-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to