I have an R script that pulls data from a MySQL database, processes it, creates several charts and graphs, prints these graphs to files and returns the file names as strings. It was working fine on our old server (Solaris 10 (32bit) running R2.10.1) but now it errors on our new server (Centos (64bit) running R 2.12.1).
I won't post the entire script as it's pretty long and most of it works fine. It still accesses the database, processes the data, creates the charts and graphs, and prints them to file. It just doesn't return the file names. This is the error:
Error in save(exp, meta, MDist.median, redgrad.pal, colgrad.pal, phase_starts, :
object âx.gcâ not found
Function brew returned an object of 'try-error'.
Below are bits of the script:
<%
Sys.umask(mode="0022")
fn=tempfile('z_')
fn.prof<-paste(fn,'prof',sep='.')
fn.data<-paste(fn,'txt',sep='.')
fn.r<-paste(fn,'rda',sep='.')
fn.graph=paste(fn,'pdf',sep='.')
library(Cairo)
library(rjson)
library(DBI)
library(RMySQL)
library(reshape)
library(plyr)
library('RColorBrewer')
library(ggplot2)
library(lattice)
library(latticeExtra)
library(hexbin)
exp_id<-ifelse(is.null(POST$exp_id),0,as.numeric(POST$exp_id))
group_id<-ifelse(is.null(POST$groupset_id),0,as.numeric(POST$groupset_id))
saveR<-ifelse(is.null(POST$saveR),FALSE,as.logical(POST$saveR))
control<-ifelse(is.null(POST$control),'rowH',as.character(POST$control))
#open connection to db
#process data
#format
#output
pdf(fn.graph,title=meta$exp_name)
dummy <- capture.output(print(plist)) #expensive: 3.56s
print(dists.med.areaplot) #expensive: 5.67s
print(dists.med.lplot)
dev.off()
####HERE IS PROBLEM####
save(exp, meta, MDist.median,
redgrad.pal, colgrad.pal,
phase_starts, voi, plist,
grect, nogrid, dists.med.areaplot, dists.med.lplot,x.gc, file=fn.r )
#return filenames to calling script
cat(toJSON(list('filename'=fn.data, 'graph_pdf'=fn.graph,'rfile'=fn.r)))
%>
Thoughts?
ETA:
It boils down to the LOCALE settings on the new server being different from the old server. The error message should have read: object "x.gc" not found
. I have found the offending object and spoken sternly to it. Problem solved (it really helps to have legible error messages!)
The original poster has answered the question. This question may be marked as answered.