Re: [R] extra panel arguments to plot.nmGroupedData {nlme}

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Mon 29 Jan 2007 - 19:54:41 GMT

On 1/28/07, Dylan Beaudette <dylan.beaudette@gmail.com> wrote:
> Greetings,
>
>
> I have a groupedData (nmGroupedData) object created with the following syntax:
>
> Soil <- groupedData(
> ksat ~ conc | soil_id/sar/rep,
> data=soil.data,
> labels=list(x='Solution Concentration', y='Saturated Hydraulic Conductivity'),
> units=list(x='(cmol_c)', y='(cm/s)')
> )
>
>
> the original data represents longitudinal observations in the form of:
> 'data.frame': 1197 obs. of 5 variables:
> $ soil_id: Factor w/ 19 levels "Arbuckle","Campbell",..: 16 16 16 16
> 16 16 16 16 16 16 ...
> $ sar : int 12 12 12 12 12 12 12 6 6 6 ...
> $ conc : num 500 100 50 10 5 1 0.003 500 100 50 ...
> $ rep : Factor w/ 3 levels "C1","C2","C3": 1 1 1 1 1 1 1 1 1 1 ...
> $ ksat : num 0.000214 0.000207 0.000198 0.000160 0.000108 ...
>
> the default plotting behaviour of this groupedData object works as expected:
> plot(
> Soil,
> collapse=1, inner=~sar, aspect='fill',
> scales=list( x=list(log=TRUE), y=list(log=TRUE))
> )
>
> ... however, there is no way for me to alter the panels...
>
> for example, attempting to add a horizontal line with a call to
> panel.abline= ... :
> plot(
> Soil,
> collapse=1, inner=~sar, aspect='fill',
> scales=list( x=list(log=TRUE), y=list(log=TRUE)),
> FUN=mean,
> panel= function(x,y, subscripts, groups) {
> panel.xyplot(x, y, type='o')
> panel.abline(h=0.005, col='black', lty=2)
> }
> )
>
> ... results in an identical plot. Trying to re-create the results of
> plot.nmGroupedData with a direct call to xyplot() has thus far been
> unsucsessful- as I cannot figure out how to specifiy the original
> formula in a meaningful way to xyplot: ksat ~ conc | soil_id/sar/rep .

You might try something like

ksat ~ conc | soil_id:sar:rep

(also see ?interaction for a version with more control)

-Deepayan



R-help@stat.math.ethz.ch 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. Received on Tue Jan 30 07:10:52 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 29 Jan 2007 - 20:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.