[R] Lattice bwplot(): Conditioning on one factor

Bert Gunter gunter.berton at gene.com
Fri Sep 28 18:43:32 CEST 2012


A small reproducible example, as requested bythe posting guide, would
have been very helpful here (if you provide one, use ?dput to provide
the data). You have also not told us what you mean by "unsuccessful,"
so we are left to guess what sort of problems you experienced.  "None
work" is completely useless to help diagnose the problem. This means
we waste time going back and forth trying to elucidate what you mean.
Please consider these things if/when you post in future.

In any case, my guess is that param is numeric and it should be a
factor, so, e.g.

 bwplot(quant ~ factor(param) | era, data=mg.d, main='Dissolved
Magnesium', ylab='Concentration (mg/L)')

might be what you want. But of course, it may be completely wrong.

Cheers,
Bert





On Fri, Sep 28, 2012 at 9:25 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Sep 28, 2012, at 7:49 AM, Rich Shepard wrote:
>
>>  I'm not able to create the proper syntax to specify a lattice bwplot() for
>> only one of two conditioning factors.
>
> Wouldn't that involve specifying the 'subset' parameter (if bwplot accepts a subset argument) or using the 'subset' function to pass the desired rows to the data argument if it doesn't?
>
>>
>>  The syntax that produces a box plot of each of the two conditioning
>> factors is:
>>
>> bwplot(quant ~ param | era, data=mg.d, main='Dissolved Magnesium', ylab='Concentration (mg/L)')
>>
>>  What I've tried unsuccessfully are:
>>
>> bwplot(quant ~ param | factor(era=='Pre-mining'), data=mg.d,
>> main='Magnesium', ylab='Concentration (mg/L))
>>
>> bwplot(quant ~ param | era, data=mg.d, main='Magnesium', ylab='Concentration
>> (mg/L)', subset=era('Pre-mining'))
>>
>> plus slight variations of the above. None work.
>>
>>  Please point me to what I've missed in specifying only one of two
>> conditioning factors for the plot.
>>
>>
> --
>
> David Winsemius, MD
> Alameda, CA, USA
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm




More information about the R-help mailing list