0

I finally figured out rapahce brew. It works without but, when I load the http:localhost/test.brew file, my browser displays a dark square. When I look at the file in the location, it is there.

Has anybody seen this?

this is the content of the test.brew file:

<%

library(reshape2)
library(ggplot2)
library(Cairo)

x <- data.frame(read.table("/R/output/output.txt", sep=",", header=T))
y <- melt(x, id=c("Hostname", "Date", "MetricType"))
y$value <-as.numeric(y$value)
yy <- dcast(y, Hostname + Date + variable ~ MetricType, fun.aggregate=mean)
yy$variable <- as.integer(gsub('Hour', '', yy$variable))
yy$variable <- paste(yy$variable, ":00:00", sep='')
yy$Date <- as.Date(yy$Date, format='%m/%d/%Y')
yy$Date <- paste(yy$Date, yy$variable)
db1 <- subset(yy, yy$Hostname=="server1")
db1<-data.frame(db1)
db1$Date <-as.POSIXct(db1$Date, "%Y-%m-%d %H:%M:%S", tz="EST")

filename <- paste(tempfile(tmpdir='/usr/local/apache2/htdocs'), '.png', sep='')
CairoPNG(filename)
qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1")
dev.off()


%>
<img src="<%=gsub('/usr/local/apache2/htdocs', '', filename)%>"/>                                   
</body>
</html>
Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
george willy
  • 1,693
  • 8
  • 22
  • 26

1 Answers1

1

In case anybody has the same question here is the answer:

print(qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1"))

qplot needed to be wrapped by the print stament.

george willy
  • 1,693
  • 8
  • 22
  • 26
  • 2
    This crops up a lot in many different situations and applies to **lattice** as well. So often, in fact, that it's a [FAQ](http://cran.at.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f). – joran Mar 09 '12 at 15:55