Chargement...
 
Imprimer

r_demo08_customoutput

Testing the customoutput parameter, introduced in PluginR v0.87, to produce no hardcoded graphical output from PluginR, but leave the r script inside the plugin to manage chart generation. In a later step, image is displayed with either img for images, or mediaplayer for pdf's, videos, etc.

{RR(echo="1", customoutput="1", cacheby="pagename")}
if(!require(ggplot2)){ install.packages("ggplot2", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(grid)){ install.packages("grid", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }

  1. --------------

p = qplot(Sepal.Width, Sepal.Length, data=iris) + facet_wrap(~Species, ncol=1)
g = ggplotGrob(p)

panels = which(sapply(g[["heights"]], "attr", "unit") == "null")
g[["heights"]]panels = list4, "cm"), unit(8, "cm"), unit(2, "cm"?

device.height = convertHeight(sum(g[["heights"]]), "points", valueOnly=TRUE)
png("testr.png", height = device.height)
grid.draw(g)
invisible(dev.off())
{RR}

{img src="temp/cache/R_r_demo08_customoutput/testr.png"}

Image

{RR(echo="1", customoutput="1", cacheby="pagename")}
require(ggplot2)
require(grid)

  1. --------------

p = qplot(Sepal.Width, Sepal.Length, data=iris) + facet_wrap(~Species, ncol=1)
g = ggplotGrob(p)

panels = which(sapply(g[["heights"]], "attr", "unit") == "null")
g[["heights"]]panels = list4, "cm"), unit(8, "cm"), unit(2, "cm"?

device.height = convertHeight(sum(g[["heights"]]), "in", valueOnly=TRUE)
pdf("testr.pdf", height = device.height)
grid.draw(g)
invisible(dev.off())
{RR} 

{mediaplayer fullscreen="true" src="temp/cache/R_r_demo08_customoutput/testr.pdf" width="100%" height="600px" style="normal" wmode="transparent"}