[R] Level sets of factors are different (panel.superpose)

Patrick Connolly p.connolly at hortresearch.co.nz
Mon Aug 12 04:33:47 CEST 2002


I investigated why I was getting this error message...

Error in Ops.factor(groups[subscripts], vals[1]) : 
	Level sets of factors are different

which led me to putting a browser in panel.superpose:

Called from: panel.superpose(x, y, subscripts, ...)
Browse[1]> vals
vals
[1] 1 2 3
Levels:  1 2 3 
Browse[1]> groups[subscripts]
groups[subscripts]
 [1] 1 2 3 1 2 1 2 3 1 2 3 1 2 3
Levels:  1 2 3 

this is the line that would fall over (in a for loop)
Browse[1]> id <- (groups[subscripts] == vals[i])

so I investigated...

Browse[1]> id <- (groups[subscripts] == vals[1])
id <- (groups[subscripts] == vals[1])
Error in Ops.factor(groups[subscripts], vals[1]) : 
	Level sets of factors are different



I've not had this problem before, so I'm guessing that in this case,
it had something to do with the fact that level 3 was missing in the
second instance.

I couldn't see why the logical couldn't work that out so I tried
something that is often necessary with lists in Splus (3.4 anyway).  I
changed the line to

id <- as.vector(groups[subscripts]) == as.vector(vals[i])

and it works (at least it doesn't fall over -- I haven't done a
thorough check to see if it really is working correctly).

Is that what is to be expected?  I can't follow why.

best

-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~


______________________________________________________
The contents of this e-mail are privileged and/or confidential to the
named recipient and are not to be used by any other person and/or
organisation. If you have received this e-mail in error, please notify 
the sender and delete all material pertaining to this e-mail.
______________________________________________________
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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