I'm working with rApache for displaying encapsulated plots that were created in R. Right now there's only one problem that I have to face. If there's only nest R code within the document, the HTML file get's rendered as some kind of single png image I think.
However, I want that it gets renderd as a document that contains graphical plots. So when I add HTML content before or within the <% ... %>
Tags, I get an broken image sign as an output.
How can I make it happen, that I can use the plot command within an HTML document?
<h1> Plot Content </h1> // adding this causes a broken image
<%
setContentType("image/png")
t <- tempfile()
png(t,type="cairo")
rndDistribution <- rnorm(100)
plot(rndDistribution)
dev.off()
sendBin(readBin(t,'raw',n=file.info(t)$size))
unlink(t)
%>
My apache.conf:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/html/R>
SetHandler r-script
RHandler brew::brew
</Directory>