[R] New Eyes Needed to See Syntax Error

Rich Shepard rshepard at appl-ecosys.com
Fri May 18 01:34:36 CEST 2012


   One of many scripts to produce 4 lattice plots on one page keeps throwing
an error. I've tried manipulating the file to eliminate the error, but have
not been able to do so. The error is:

> source('bicarb.R')
Error in source("bicarb.R") : bicarb.R:15:1: unexpected symbol
14: 15: hco33
    ^

   The 'h' is in column 0 so the caret would be column -1, but it's presented
as column 1. The file, bicarb.R is:

hco31 <- qqmath(~ HCO3 | factor(basin), data = surfchem.cast, main = 
'Bicarbonate (Raw)',
   prepanel = prepanel.qqmathline,
   panel = function(x, ...) {
     panel.qqmathline(x, ...)
     panel.qqmath(x, ...)
   })

hco32 <- qqmath(~ log10(HCO3 | factor(basin), data = surfchem.cast, main = 
'Bicarbonate (Log10)',
   prepanel = prepanel.qqmathline,
   panel = function(x, ...) {
     panel.qqmathline(x, ...)
     panel.qqmath(x, ...)
   })

hco33 <- qqmath(~ sqrt(HCO3 | factor(basin), data = surfchem.cast, main = 
'Bicarbonate (Square Root)',
   prepanel = prepanel.qqmathline,
   panel = function(x, ...) {
     panel.qqmathline(x, ...)
     panel.qqmath(x, ...)
   })

hco34 <- qqmath(~ HCO3^1/3 | factor(basin), data = surfchem.cast, main = 
'Bicarbonate (Cubic Root)',
   prepanel = prepanel.qqmathline,
   panel = function(x, ...) {
     panel.qqmathline(x, ...)
     panel.qqmath(x, ...)
   })

pdf('hco3.pdf')
plot(hco31, split = c(1,1,2,2), more = TRUE)
plot(hco32, split = c(1,1,2,2), more = TRUE) plot(hco33, split = c(1,2,2,2), 
more = TRUE)
plot(hco34, split = c(2,2,2,2), more = FALSE)
dev.off()

   If the error is not apparent to you, please suggest what I could try to
isolate the cause.

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