Extension:Shiny
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
Shiny Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | Allows to embed Shiny apps on pages |
Author(s) | Sigbert Klinke (Sigberttalk) |
Latest version | 0.1 (2016-02-28) |
MediaWiki | 1.26+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | GitHub:
<translate> Note:</translate> |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The Shiny extension allows to embed Shiny apps in pages. The Shiny server itself uses the programming language R, which is a free software environment for statistical computing and graphics.
Requirements
- R is a free software environment for statistical computing and graphics. It needs to be installed (probably available in your Linux distribution) and in the PATH: the command
R
should work on the command line.
- The Shiny server lets you put shiny web applications online. It needs to be installed separately.
Download
You can obtain the extension from GitHub.
Installation
The following subpages describe the installation process for
- Ubuntu 14.04 and
- CentOS 7
with an Apache web server. For other linux systems or web servers the description needs to be adapted.
Extension files
extension.json
- stores the setup instructions.
Shiny_body.php
- stores the execution code for the extension.
All other files in the <my.wiki>/extensions/Shiny
could be deleted.
Configuration
The file extension.json
contains three configuration variables which could be set:
"config": { "ShinyR": "/usr/bin/R", "ShinyAppDir": "/srv/shiny-server/mediawiki", "ShinyUrl": "http://localhost/shiny/mediawiki" },
ShinyR
- the path and command to execute R. You may query for it in your system by using the command
which R
ShinyAppDir
- the path where the Shiny apps are stored. Note that the actual path where
app.R
is stored is/srv/shiny-server/mediawiki/<my.wiki.name>/<page.title>/<shiny.app.name>
ShinyUrl
- the URL which is called to access a Shiny app. Note that the actual URL for a shiny app is
http://localhost/shiny/mediawiki/<my.wiki.name>/<page.title>/<shiny.app.name>
Usage
For a simple example put into a wiki page:
<shiny output="plot" name="test"> hist(rnorm(314)) </shiny>
It shows a histogram of 314 random values according to a standard normal distribution.
Some hints for development:
- For developing a Shiny app you are urged to use RStudio. If the app runs under RStudio then it will also work with MediaWiki.
shiny
tag
The shiny
tag can have the following attributes:
output="..."
...
corresponds to data
dataTableOutput
andrenderDataTable
image
imageOutput
andrenderImage
plot
plotOutput
andrenderPlot
print
verbatimTextOutput
andrenderPrint
table
tableOutput
andrenderTable
text
textOutput
andrenderText
verb
print
- Note if
output
is omitted then between the start and end tag is a fully fledged shiny app is expected. name="..."
- the name of the Shiny app. If not set then a hash value from the R program is derived.
- CAUTION: Omitting the name may lead to a lot of sub-directories for the shiny server, therefore choose a name!
width="..."
- the width of the windows in pixel (default: 800)
height="..."
- the height of the windows in pixel (default: 600)
seamless="..."
- if the Shiny app is embedded seamlessly (
seamless="seamless"
, default) or not (any other text for seamless) sandbox="..."
- enables extra restrictions on the content that can appear in the inline frame. (default:
allow-same-origin allow-scripts
). The value of the attribute can either be an empty string (all the restrictions are applied), or a space-separated list of tokens that lift particular restrictions. Valid tokens are:
Token Allows allow-forms
the embedded browsing context to submit forms allow-popups
to open popups (like from window.open, target="_blank", showModalDialog) allow-same-origin
the content to be treated as being from its normal origin allow-scripts
the embedded browsing context to run scripts (but not create pop-up windows) allow-top-navigation
the embedded browsing context to navigate (load) content to the top-level browsing context.
Errors
- In the wiki page only an
<iframe ...>...</iframe>
is shown instead of the Shiny app. - In case that this error occurs the extension shows the resulting HTML code instead of embedding. Check for typos/errors in the options or in your R program.
- In the Shiny app only
ERROR: Key / already in use
is displayed - Delete from your R code the
runApp(...)
line.
Security
Currently no security measures are implemented.
- Pages with script errors
- Pages with broken file links
- Unmaintained extensions
- Extensions without an image
- Tag extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- GPL licensed extensions
- Extensions in GitHub version control
- ParserFirstCallInit extensions
- All extensions
- Extensions not in ExtensionJson
- Math extensions
- Graph extensions
- Math display extensions