Learn R Programming

AnalysisPageServer (version 1.6.2)

embed.APS.dataset: embed.APS.dataset

Description

Embed an APS dataset

Usage

embed.APS.dataset(plot, df, title, show.sidebar = TRUE, show.table = TRUE, num.table.rows = 10, extra.html.classes = character(), extra.div.attr = character(), svg.args = list(), eval.args = list(envir  = parent.frame()), outdir = get.APS.outdir(), randomize.filename = TRUE, ...)

Arguments

plot
If present, then either an expression, a function, or a path to SVG file (not yet annotated). If an then the expression will be evaluated after opening a plotting device. The expression will be evaluated in the calling frame, so your local variables will be accessible, but this can be changed by modifying eval.args. If a function, then the function will be called with no arguments. In that case you would control the context yourself by setting the function's environment. If path to an SVG then you would have already made the plot, and that would be used. If missing then no plot is drawn---only the table is shown.
df
data.frame of data. If omitted, then the return value of evaluating the plotting expression or function is used (if plot is not a character).
title
Caption for plot
show.sidebar
Boolean, default TRUE. Set to FALSE to not show the sidebar (filtering, tagging). (This is passed through directly to aps.dataset.divs.)
show.table
Boolean, default TRUE. Set to FALSE to not show the data table (still available on download. (This is passed through directly to aps.dataset.divs.)
num.table.rows
Number of table rows to show. Default: 10 (This is passed through directly to aps.dataset.divs.)
extra.html.classes
Charvec of extra HTML classes to include in the div. (This is embedded in a list then passed through directly to aps.dataset.divs.)
extra.div.attr
Names charvec of extra attributes to include in the div. (This is embedded in a list then passed through directly to aps.dataset.divs.)
svg.args
Arguments (other than filename) to pass to the svg function. This should be a named list. In particular, consider something like list(width = 8, height=5) to change the aspect ratio.
eval.args
Arguments to pass to evalq when evaluating your plot code. Ignored if plot is character or a function. Otherwise it should be a named list. Default is list(envir = parent.frame()), which means the evaluation will happen in the calling frame.
outdir
Output directory. Default: get.APS.outdir(), which is either "." or the directory of your knit2html target .html file.
randomize.filename
Passed through to static.analysis.page (but here the default is TRUE).
...
Passed through to static.analysis.page. ot overwrite, outdir, or write.client

Value

Returns the div, invisibly.

Details

This function is meant to be called in a knitr document that is being knit with knit2html. It makes a few assumptions that are valid in that context.

It makes a call to static.analysis.page for you to annotate and write the SVG and JSON files, then emits the

element to STDOUT. outdir defaults to ".". It only does one plot/dataset at a time.

Examples

Run this code
message("See vignette embedding.html")

Run the code above in your browser using DataLab