[R] sample {base}
Makram Talih
makram.talih at yale.edu
Thu Aug 15 20:22:35 CEST 2002
Hello,
Is there any logistic (or other) reason why the function sample, with
usage sample(x, size, replace = FALSE, prob = NULL) does not have a
default method when length(x) is equal to 1 but x is non-integer? The
default in the integer x case is an internal call to sample with x
replaced by 1:x . This of course generates an error message when x is a
character vector, say, with variable length -- in my case usually greater
than 1, but occasionally equal to 1 !
What I do now is simply make a special case in my code for length(x) == 1,
but shouldn't this be incorporated in the function itself?
Thank you in advance for any clarification regarding this issue, and
please excuse my ignorance if the answer is obvious.
Regards,
Makram Talih
Yale U. (Statistics)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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