[R] a problem with rep() ?

S.McClatchie s.mcclatchie at niwa.cri.nz
Tue Jun 12 04:57:55 CEST 2001


Colleagues

----------------------------------
System info:
Version 1.2.3  (2001-04-26) on NT
ESS v. 5.1.18 using emacs ver. 20.4

----------------------------------
I am wondering if there is a problem with the function rep(). Both the 
commands using rep() below were expected to produce 8 twos, but only 
the second did.

x <- rep(2,40*(1-0.8))
length(x)

y <- rep(2,40*0.2)     
length(y)

Have I misused the function? Should the second argument of rep() be 
limited to a single number or a vector of the same length as the first 
argument as it documents in the help? Or is this a bug?

Help will be appreciated.
Thanks

Sam

Sam McClatchie, Research scientist (fisheries acoustics))))))))))
NIWA (National Institute of Water & Atmospheric Research Ltd)
PO Box 14 901, Kilbirnie, Wellington, New Zealand
s.mcclatchie at niwa.cri.nz 

                    /\
...>><xX(°> // \\
                 /// \\\   
                //// \\\\
               ///  <°)Xx><<
              /////  \\\\\\
        ><(((°>   
  >><(((°>   ...>><xX(°>O<°)Xx><<

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