Lattice levelplot only fails under RApache

I am working on a PHP web application that calls R through curl and RApache. Most things work great. But one lattice graph causes this error:

Warning / error RApache !!! Error in uy + c (-1, 1): non-numeric argument for binary operator

I tried to save the data structures that are passed to the plot and make the plot in my local R, but then the plot works just fine. Therefore, I cannot reproduce the error.

These are the loaded libraries when the script is executed 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 little 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 the link to the data file. I read it like this:// the link seems unreliable, therefore removed

The data is as follows:

'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 best to fix this problem?

ETA Version / Platform Information

        [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)
+3
1

. :

  • plot() ., () save(x, y, z, ..., file="/tmp/dbg.RData")
  • "" R
  • , .., .
+2

Source: https://habr.com/ru/post/1770156/


All Articles