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

Rich Shepard rshepard at appl-ecosys.com
Wed May 16 00:19:30 CEST 2012


On Tue, 15 May 2012, David L Carlson wrote:

> qqmath(~ rnorm(100),
>  panel = function(x, ...) {
>    panel.qqmathline(x, ...)
>    panel.qqmath(x, ...)
>  })

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')".

   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'),
   prepanel = prepanel.qqmathline,
   panel = function(x, ...) {
     panel.qqmathline(x, ...)
     panel.qqmath(x, ...)
   })
dev.off()

and R returns,

> source('metals.R')
Error in source("metals.R") : metals.R:4:83: unexpected ','
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



More information about the R-help mailing list