[R] Consistent behaviour of for-loop

Peter Ehlers ehlers at ucalgary.ca
Thu Apr 15 13:16:13 CEST 2010


On 2010-04-15 5:00, Uwe Dippel wrote:
> Peter Ehlers wrote:
>> You are mixing 'traditional' graphics (par(...)) and
>> 'lattice' graphics.
>> That won't work. In lattice, you use the 'layout' argument to
>> select the number of columns/rows. This is easiest if you set
>> up a conditioning variable:
>>
>> cond <- gl(12, 20, labels = letters[1:12])
>> x <- rnorm(12*20)
>> qqmath(~x | cond, layout = c(4, 3))
>>
>> Note that layout = c(columns, rows), not c(rows, columns).
>>
>> Since you're new to R, let me also recommend very strongly
>> that you learn to use the str() function (not needed for
>> this problem, but undoubtedly indispensible in your further
>> adventures in R-land).
> Nice example, and good recommendation!
>
> (It is difficult to satisfy me:)
> How can one know/see, what is traditional graphics, and what is lattice
> graphics? Or is it try-and-fail-and-use-the-alternative?

You have to do a fair amount of reading. There's a whole chapter
on base graphics in the Intro to R, which also (briefly) mentions
lattice graphics. And then there's the ggplot2 package ...

Beginners should definitely work through the Intro to R.

It takes time and patience.

  -Peter Ehlers

>
> Thanks,
>
> Uwe
>
>

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list