[R] Problem with match.arg()

Kjetil Kjernsmo kjetil.kjernsmo at astro.uio.no
Sat May 6 22:21:57 CEST 2000


Dear all,

I have a problem with match.arg().

Occasionally, I get the error message:
Error in arg == choices : comparison (1) is possible only for vector types
and upon grepping through the R code, I found that the only place the
string "arg == choices" appears is in match.arg(), and indeed, I call 
this function in a function of mine that starts like this:
ramp <- function(n, type=c("point", "nolens"))
{
  type <- match.arg(type)
it seems like standard usage from the example in the docs.

The strange thing is that I can run my function thousands of times without
this error occuring, and sometimes it happens without any change of input
parameters (there are however drawing of random numbers involved, that is
what the 'r' of 'ramp' indicates).

Any ideas?

Best,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj at astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster at skepsis.no 

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