[R] Lattice: Add abline to Single Value qqmath() Plot

ilai keren at math.montana.edu
Wed May 16 01:37:36 CEST 2012


On Tue, May 15, 2012 at 4:19 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Tue, 15 May 2012, David L Carlson wrote:
>
> David,
>
>  I have 130 plots to produce (30 chemicals un-transformed and three
> transformations). The R console insists that I retype each of the 6 lines
> (adding a prepanel.qqmathline line) each time. Makes more sense to put all
> the commands in a script that I can run within R using "source('metals.R')".
>

Apologies in advance if I misinterpret " R console insists that I
retype ..." but actually makes more sense (than sourcing a script) to
use the group argument (see the last example in ?qqmath) as in 4
groups in each of 30 panels, or allow.multiple=T, outer=T if you
really want separate panels for each transformation. Also can use
layout=c(1,1,120) if you need each in a separate page  - or say
c(3,2,20) for 20 pages of 6 panels each, etc. Regarding your script,
there is a syntax error:

>  However, R appears to not see that the first line does not terminate the
> command and the following lines are continuations. The source is,
>
> pdf('ag_norm.pdf')
> qqmath(~ Ag | factor(basin), data = surfchem.cast, main = 'Silver
> (Untransformed'),

Right here the " ' " is on the wrong side of " ) " causing the error:

> Error in source("metals.R") : metals.R:4:83: unexpected ','

because the plot is "done" with ) with unexpected "," following. You want
...main = ' Silver (Untransformed) ' ,

Personally I find using spaces whenever possible helps me avoid this
type of syntax error (which is the most frustrating...)

Cheers


> 3: pdf('ag_norm.pdf')
> 4: qqmath(~ Ag | factor(basin), data = surfchem.cast, main = 'Silver
> (Untransformed'),
>
> with a caret under the last ')'.
>
>  What syntax error did I commit in the call to qqmath() above?
>
> Rich
>
> --
> Richard B. Shepard, Ph.D.          |   Integrity - Credibility - Innovation
> Applied Ecosystem Services, Inc.   |    Helping Ensure Our Clients' Futures
> <http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
>
> ______________________________________________
> 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