Description Usage Arguments Details Value Author(s) See Also Examples
Validate and prepare a handler for installation
1 2 3 4 5 6 | new.analysis.page(handler, param.set = NULL, annotate.plot = TRUE,
class.name = "plot-point", standard.ids = TRUE, skip.checks = FALSE,
plot.pars.transformer = NULL, annotate.data.frame = TRUE,
numeric.sig.digs = 3, no.plot = FALSE, name = NULL, label = name,
description = label, advanced = 0, thumbnail = NULL, service = FALSE,
in.menu = !service, paramset.transformer = NULL)
|
handler |
A handler function, as described above. |
param.set |
An AnalysisPageParamSet to use for the function. Or NULL, to call |
annotate.plot |
Logical. Should plots generated by this handler be automatically annotated? Default: TRUE. |
class.name |
Character. What class label should be applied to automatically annotated points? Default: "plot-point". (Ignored
if |
standard.ids |
Logical. By default (TRUE), the rownames of your return value are ignored, and new ones are created like
"Reg1","Reg2". The advantage of this is that these IDs are guaranteed to be standard-compliant HTML and SVG id tags.
If you want to force using your real rownames as IDs (for example, to help in debugging), then set this to FALSE (FALSE is
implemented but not tested).
Or you can provide a function with the same signature as |
skip.checks |
Logical. By default (FALSE) your handler is run once on its default arguments, and it is checked that it makes an SVG and that the SVG can be annotated (if annotate.plot was set). This is important to get right, but doens't really need to be done during production—it just slows down the server start up. |
plot.pars.transformer |
A function to transform plot parameters. It should have the signature |
annotate.data.frame |
Logical, indicating whether your return value should be passed throuhg |
numeric.sig.digs |
Number of significant digits to which numeric columns in your data should be rounded.
Default: 3. Set to NULL to not round (you
could still round within your function if you wanted tighter control). "numeric" here means either that you set the a varMetadata
"type" of the column to the string "numeric", or, if that is not available that |
no.plot |
This page is meant to return data but no plot. Default: FALSE (it *is* expected to return a plot). |
name |
A name for the analysis page. Defaults to deparsing the handler argument. This meant to be an internal identifier for the page, only displayed to the user if label and description are unavailable. |
label |
A display label for the page. This should be 1-3 words, to fit in the navbar. Default: name. |
description |
A longer description for the page. This should be 1-2 sentences, to appear on rollover or in a summary page. Default: label |
advanced |
An integer. 0 means not advanced (always display the page). 1, 2, 3 are increasing levels of advanced (only display the page in advanced mode). Default: 0 |
thumbnail |
A URL for a thumbnail to use when listing the page. NULL means to not store any thumbnail. |
service |
A logical, default FALSE. TRUE means that this page should only be called as a service and should not be rendered as a user page. This also means that the return value will not be processed at all except for JSON-encoding (unless of course you return an AnalysisPageResponse). |
in.menu |
A logical, default |
paramset.transformer |
A function which accepts a named list of parameter values as its first argument and possibly
the AnalysisPage object as its second argument, and returns a named list of parameter values. This transformation is applied
last, after the individual parameters have been transformed, if applicable, but (of course) before the handler is called.
Or NULL (default) to not do this transformation. The purpose of this is to be able to encode some reusable logic here for
groups of parameters which would often be used together but whose transformation is inter-dependent.
If both this argument and |
An AnalysisPage handler is a function that satistifies the following properties:
Can be called with no arguments and return a valid value (to be used for
testing in the next steps; although this can be relaxed with skip.checks
).
It creates a plot but does not open the device (although this can be relaxed with do.plot
)
It returns a data.frame with x
and y
fields. Alternatively it may return an AnnotatedDataFrame
. (although this can be relaxed with annotate.data.frame
)
x
and y
fields are numeric.
The points in test plot can be successfully found (based on the x and y coordinates) and labeled.
This function throws an error if the argument does not satistfy one of these. Otherwise it returns void.
The function will be called once at the time of running this function (typically during registration) with all of its defaults to verify the second and third requirements.
The return value is a list of class "AnalysisPage" with the following components:
$handler
The handler function
$params
An AnalysisPageParamSet
(see param.set
)
$annotate.plot
An logical indicating whether the plots generated by the handler should be automatically annotated
$class.name
A character giving the class to be applied to the annotated SVG elements
A list will be built with the information necessary to render the page. It will
contain the handler function in the $function
slot, as well as a $params
slot listing all of the parameters and their relevant information. The class name of
"AnalysisPage" will be slapped on this object for good measure.
See above
Brad Friedman
register.page
, execute.handler
, AnnotatedDataFrame
1 2 3 4 | page <- new.analysis.page(AnalysisPageServer:::sine.handler)
registry <- register.page(new.registry(), "sine", page)
## Note: above is equivalent to the following:
## registry <- register.page(registry, "sine", AnalysisPageServer:::sine.handler)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.