embed.APS.dataset {AnalysisPageServer} | R Documentation

## embed.APS.dataset

### Description

Embed an APS dataset

### Usage

    embed.APS.dataset(plot, df, title, show.sidebar = TRUE, show.table = TRUE,
      allow.zoom = TRUE, plot.height = NULL, div.width = NULL, style = NULL,
      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`.)
`allow.zoom` | If TRUE (default) then allow zooming and panning. IF FALSE then do not allow it.
`plot.height` | If NULL (default) then do not specify 'data-plot-height' attribute. Otherwise, use this number as 'data-plot-height' attribute, which will specify the plot height (in pixels)
`div.width` | If NULL (default) then do not specify div width in style. Otherwise, supply a valid CSS width (e.g. "200px" or "60 and this will be rolled into the inline-style
`style` | String specifying inline style of this div or NULL (default). If NULL then and `div.width` is also NULL then do not specfiy any inline style. If NULL and `div.width` is non-NULL then create a centered div of `div.width` pixels wide with `style="width:100px; margin:0 auto"` (or whatever div.width is, instead of "100px"). If non-NULL then use the string directly as the style attribute of the div.
`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`

### 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 `<div>` element to STDOUT. `outdir` defaults to ".". It only does one plot/dataset at a time.

### Value

Returns the div, invisibly.

### Author(s)

Brad Friedman

### Examples

    message("See vignette embedding.html")

[Package AnalysisPageServer version 1.20.0 Index]