I'm working on a PHP web app that calls R through curl and RApache. Most things work fine. But one lattice plot throws this error:
RApache Warning/Error!!!Error in uy + c(-1, 1) : non-numeric argument to binary operator
I tried saving the data structures that feed into the plot and doing the plot in my local R, but then the plot works just fine. So I can't replicate the error.
These are the loaded libraries when the script runs in RApache:
library(Brew)
library(Cairo)
library(rjson)
library(DBI)
library(RMySQL)
library(reshape)
library(plyr)
library('RColorBrewer')
library(ggplot2)
library(lattice)
library(latticeExtra)
library(hexbin)
Here is a bit of the script:
colgrad.pal<-colorRampPalette(brewer.pal(11,'Spectral'), interpolate='spline')
//problem plot
dists.med.lplot<-levelplot(value~starttime+groupname|dists, data=MDist.median,
col.regions=rev(colgrad.pal(200)),colorkey=list(col=rev(colgrad.pal(200))),
xlab='Time(s)',ylab='Treatment',
main='Level Plot of Median Distance',
layout=c(1,3))
And here is a link to a datafile. I read it in like this: //link appears untrustworthy, so removed
Data looks like this:
'data.frame': 2880 obs. of 6 variables:
$ groupname: Factor w/ 8 levels "rowA","rowB",..: 1 1 1 1 1 1 1 1 1 1 ...
$ fCycle : Factor w/ 6 levels "Cycle 1","Cycle 2",..: 6 6 6 6 6 6 6 6 6 6 ...
$ fPhase : Factor w/ 2 levels "Dark","Light": 1 1 1 1 1 1 1 1 1 1 ...
$ starttime: int 0 60 120 180 240 300 360 420 480 540 ...
$ dists : Factor w/ 3 levels "inadist","lardist",..: 1 1 1 1 1 1 1 1 1 1 ...
$ value : num 47.5 64 78.3 39.2 53.7 ...
Any ideas on what the problem is or how to better troubleshoot this?
ETA version/platform info
[platform] => sparc-sun-solaris2.10
[arch] => sparc
[os] => solaris2.10
[system] => sparc, solaris2.10
[status] =>
[major] => 2
[minor] => 10.1
[year] => 2009
[month] => 12
[day] => 14
[svn rev] => 50720
[language] => R
[version.string] => R version 2.10.1 (2009-12-14)