[R] order of panels in xyplots

Titus Malsburg malsburg at gmail.com
Thu Nov 26 11:04:42 CET 2009


Peter, thanks for your response!  The problem is not how indexing
works, but rather the question what is being indexed here.  If I
understand the description correctly then it is wrong.  In the special
and common case where all possible levels do actually occur in the
data frame it coincidentally happens to work the way it is described
but not when the data frame contains only data points for some of the
levels.  Then it appears that the indexing vector has to be bound to
1:length(unique(f)) which is unequal 1:nlevels(f).  (f is a factor
here.)

  Titus

On Wed, Nov 25, 2009 at 10:32 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
>
> Titus Malsburg wrote:
>>
>> The documentation of xyplot could be improved here.  It says:
>>
>>  "If 'index.cond' is a list, it has to be as long as the number of
>> conditioning
>>   variables, and the 'i'-th component has to be a valid indexing vector
>> for the
>>   integer vector '1:nlevels(g_i)' (which can, among other things, repeat
>> some
>>   of the levels or drop some altogether)."
>>
>> It should make explicit that nlevels is the number of levels actually
>> used in the data and not length(levels(f)).
>>
> It does say "... _valid_ indexing vector ..." (my emphasis).
> If nlevels(g) = 5, but you're only plotting 3 panels, it seems
> to me that c(3,1,5) might be a valid indexing vector.
>
>  -Peter Ehlers
>
>> Cheers,
>>
>>   Titus
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>




More information about the R-help mailing list