FramedHTML {HTMLUtils} | R Documentation |
Creates a framed HTML page displaying plots and annotations that can easily be navigated. The plots can be created either 'on the fly' by passing the appropriate commands or beforehand in which case just the filenames need to be passed. The user has a great deal of flexibility in choosing appropriate directory structures.
FramedHTML(cmds = NULL, basepath = paste(Sys.getenv("HOME"), "/public_html/", sep = ""), path = "tmp", Graphpath = "Figures/", DiagnosticsPath = "Diagnostics", file = "tmp", HTMLobjects, Captions=NULL, MenuLabels1=NULL, MenuLabels2=NULL, Comments=NULL, title = "", width = 480, height = 480, REFRESH = "", APPEND = FALSE, verbose = 1)
cmds |
list of commands that generates the plots. If missing, the graphfiles are assumed to exist already. |
basepath |
base path of public_html directory |
path |
subdirectory of basepath ; will be created if non existing |
Graphpath |
subdirectory of basepath/path/ containing the graphfiles; will be created if non existing |
DiagnosticsPath |
subdirectory of basepath/path/ containing diagnostic output; will be created if non existing |
file |
file name of main page; '.html' extension will be added. The '_main' and '_menu' pages use this base as well. |
HTMLobjects |
list of graph filenames, either to be created by the list of commands or to be copied to the Figures subdirectory and/or dataframes to be displayed in sortable tables. |
Captions |
vector of captions; these go directly below the graphs |
MenuLabels1 |
vector of labels for the menu navigation page. It helps to keep these succinct and short ! |
MenuLabels2 |
vector of labels for the main page; these go on top of the individual graphs, so they are complementary to the captions. |
Comments |
Text/comments to be written between the graphs |
title |
title to be written in the navigation/menu page |
width |
width for all graphfiles |
height |
height for all graphfiles |
REFRESH |
Meta refresh is a method of instructing a web browser to automatically refresh the current web page after a given time interval. |
APPEND |
append to existing HTML page ? |
verbose |
level of verbosity |
There is not much eror checking. In particular, the lengths of the argumentscmds, graphfiles, Captions, MenuLabels1, MenuLabels2
need to be all the same !
Markus Loecher, Sense Networks <markus@sensenetworks.com>
#example with plots and graphfiles being generated on the fly: ## Not run: FramedHTML(cmds = list("plot(rnorm(100));","plot(1:10);"), HTMLobjects =list("Fig1.png", "Fig2.png"), Captions=c("Gaussian noise","seq 1:10"), MenuLabels1 = c("Label1","Label2"), MenuLabels2 = c("Marvel at the graph below","scatterplots are nice"), Comments = c("100 random numbers","Simple plot"), title="Test Page",width=480, height=480, verbose=1) #example with plots and graphfiles having been generated beforehand: png("Fig1.png"); plot(rnorm(100)); dev.off() png("Fig2.png"); plot(1:10); dev.off(); FramedHTML( HTMLobjects = list("Fig1.png", "Fig2.png"), Captions=c("Gaussian noise","seq 1:10"), MenuLabels1 = c("Label1","Label2"), MenuLabels2 = c("Marvel at the graph below","scatterplots are nice"), Comments = c("100 random numbers","Simple plot"), title="Test Page",width=480, height=480, verbose=1); #example with absolute paths for graphfiles : Fig1 <- paste(tempdir(),"/Fig1.png",sep="") png(Fig1); plot(rnorm(100)); dev.off() Fig2 <- paste(tempdir(),"/Fig2.png",sep="") png(Fig2); plot(1:10); dev.off(); FramedHTML( HTMLobjects = list(Fig1, Fig2), Captions=c("Gaussian noise","seq 1:10"), MenuLabels1 = c("Label1","Label2"), MenuLabels2 = c("Marvel at the graph below","scatterplots are nice"), Comments = c("100 random numbers","Simple plot"), title="Test Page",width=480, height=480, verbose=1); #cleanup: #system(paste("rm ", Fig1));system(paste("rm ", Fig2)) ## End(Not run) #example with sorted table: ## Not run: x <- cbind.data.frame(x1 = round(rnorm(10),3), x2 = round(runif(10),3)); ## Not run: attr(x, "HEADER") <- "some random numbers"; ## Not run: FramedHTML(HTMLobjects = list("Fig1.png", x, "Fig2.png"), MenuLabels1 = c("Label1","Label2","Label3"), MenuLabels2 = c("Marvel at the graph below","JavaScript rocks","scatterplots are nice"), Captions=c("Gaussian noise","Gaussian and uniform random numbers", "seq 1:10"), path = "tmp", file = "index"); ## End(Not run)