Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Rapache brew正在生成暗图_R_Rapache - Fatal编程技术网

Rapache brew正在生成暗图

Rapache brew正在生成暗图,r,rapache,R,Rapache,我终于想出了rapahce brew。它可以不使用,但是当我加载http:localhost/test.brew文件时,我的浏览器会显示一个黑色方框。当我查看该位置中的文件时,它就在那里 有人见过这个吗 这是test.brew文件的内容: <% library(reshape2) library(ggplot2) library(Cairo) x <- data.frame(read.table("/R/output/output.txt", sep=",", header=T)

我终于想出了rapahce brew。它可以不使用,但是当我加载http:localhost/test.brew文件时,我的浏览器会显示一个黑色方框。当我查看该位置中的文件时,它就在那里

有人见过这个吗

这是test.brew文件的内容:

<%

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>

如果有人有相同的问题,下面是答案:

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

qplot需要用打印纸包装。

这些问题最好在rapache google group上回答。问问那边。这在很多不同的情况下都会出现,同样适用于晶格。事实上,这常常是一个问题。