[R] Problem with match.arg()

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun May 7 00:21:10 CEST 2000


Kjetil Kjernsmo <kjetil.kjernsmo at astro.uio.no> writes:

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

Well, what would seem to be happening is that ramp is getting called
with a strange 2nd arg, most likely a function, as in

> f<-function(x=c("aardvark","bison"))
+ {match.arg(x)}
> f(ls)
Error in arg == choices : comparison (1) is possible only for vector
types

You could try setting options(error=quote(dump.frames())) to figure
out what is going on (see help(dump.frames)).

It may be that something has been corrupted by a garbage collection at
just the wrong time, so if debugging doesn't reveal a bug in your own
code and things look strange, drop us a line with some more info
(preferably with simplified code to reproduce the effect).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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