then change "trunc" to "ceiling"???

Peter Dalgaard BSA wrote:
"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.


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

Reply via email to