Skip to content
Prev 294697 / 398502 Next

Lattice: Add abline to Single Value qqmath() Plot

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

   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,
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