[R] Loop removal?

Peter Malewski p.malewski at tu-bs.de
Sun Jul 30 19:06:49 CEST 2000


On Sun, 30 Jul 2000, Peter Malewski wrote:

> BUT NOTE, that this only works if 
> 
> length(x) %% g == 0

btw you can avoid this with 

xx <- function(x,g=2)rep(
                   rep(1:g,rep(length(x) / g  , g ) )
                   ,length.out=length(x)
                   )
(without warnings)
xx <- function(x,g=2)cbind(
                   rep(1:g,rep(length(x) / g  , g ) ) ,x )[,1]

(with warnings)



**************************************************************************
P.Malewski				Tel.: 0531 500965
Maschplatz 8				mailto: Peter.Malewski at gmx.de
************************38114 Braunschweig********************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list