Difference between revisions of "R-tools"
(Descriptive R-Tools page created) |
(categorised) |
||
Line 1: | Line 1: | ||
− | + | [[Category:R tool]] | |
− | + | {{method|moderator=Ehac}} | |
− | == Libraries == | + | '''R-Tools''' is a MediaWiki extension that allows registered Opasnet users to run [http://www.r-project.org R] code directly from a wiki page. |
+ | |||
+ | ==Question== | ||
+ | |||
+ | How should [[R]]-based modelling be performed in a MediaWiki environment? | ||
+ | |||
+ | ==Answer== | ||
+ | |||
+ | === Libraries === | ||
Opasnet R software has some additional libraries installed for plotting (e.g. ggplot2) and also some libraries that enable connecting to external databases (e.g. OpasnetBaseUtils). More libraries can be installed on request with proper reasons. | Opasnet R software has some additional libraries installed for plotting (e.g. ggplot2) and also some libraries that enable connecting to external databases (e.g. OpasnetBaseUtils). More libraries can be installed on request with proper reasons. | ||
− | == Usage == | + | === Usage === |
R-tools uses <nowiki><rcode></nowiki> tags. Any R code written between these tags can be run from wiki page using the "Run code"-button. Press the button and new window (or tab) opens up showing the status and the results of the run in real time. An example code that counts one plus one using R: | R-tools uses <nowiki><rcode></nowiki> tags. Any R code written between these tags can be run from wiki page using the "Run code"-button. Press the button and new window (or tab) opens up showing the status and the results of the run in real time. An example code that counts one plus one using R: | ||
<pre> | <pre> | ||
Line 13: | Line 21: | ||
</pre> | </pre> | ||
− | == Parameters == | + | === Parameters === |
Some optional parameters can be given to <nowiki><rcode></nowiki> tag as described below. | Some optional parameters can be given to <nowiki><rcode></nowiki> tag as described below. | ||
* graphics - If the code is meant to draw any graphs then define graphics to '1'. | * graphics - If the code is meant to draw any graphs then define graphics to '1'. | ||
* variables - Allows user to input values for named variables in R code. Inputs will be displayed in a box below the actual R code in wiki page. Variables syntax is described in its own chapter in this page. | * variables - Allows user to input values for named variables in R code. Inputs will be displayed in a box below the actual R code in wiki page. Variables syntax is described in its own chapter in this page. | ||
− | == Variables syntax == | + | === Variables syntax === |
Each variable needs three attributes separated with | (pipe) character. These attributes (in correct order) are ''variable name in code'',''variable description in wiki page'' and ''default value''. Variable triplets must also be separated with pipe. An example R code with two defined attributes calculates the area of a rectangle: | Each variable needs three attributes separated with | (pipe) character. These attributes (in correct order) are ''variable name in code'',''variable description in wiki page'' and ''default value''. Variable triplets must also be separated with pipe. An example R code with two defined attributes calculates the area of a rectangle: | ||
<pre> | <pre> | ||
Line 27: | Line 35: | ||
</pre> | </pre> | ||
Note that variable default value can also be a string or even an array (e.g. c(1,2,3) or 'Some name'). | Note that variable default value can also be a string or even an array (e.g. c(1,2,3) or 'Some name'). | ||
+ | |||
+ | ==Rationale== | ||
+ | |||
+ | ==See also== | ||
+ | |||
+ | ==Keywords== | ||
+ | |||
+ | ==References== | ||
+ | |||
+ | <references/> | ||
+ | |||
+ | ==Related files== | ||
+ | |||
+ | {{mfiles}} |
Revision as of 14:41, 26 June 2011
This page is a method.
The page identifier is Op_en5247 |
---|
Moderator:Ehac (see all) |
Give your opinion to the peer rating of the content of this page. |
Upload data
|
R-Tools is a MediaWiki extension that allows registered Opasnet users to run R code directly from a wiki page.
Contents
Question
How should R-based modelling be performed in a MediaWiki environment?
Answer
Libraries
Opasnet R software has some additional libraries installed for plotting (e.g. ggplot2) and also some libraries that enable connecting to external databases (e.g. OpasnetBaseUtils). More libraries can be installed on request with proper reasons.
Usage
R-tools uses <rcode> tags. Any R code written between these tags can be run from wiki page using the "Run code"-button. Press the button and new window (or tab) opens up showing the status and the results of the run in real time. An example code that counts one plus one using R:
<rcode> 1+1 </rcode>
Parameters
Some optional parameters can be given to <rcode> tag as described below.
- graphics - If the code is meant to draw any graphs then define graphics to '1'.
- variables - Allows user to input values for named variables in R code. Inputs will be displayed in a box below the actual R code in wiki page. Variables syntax is described in its own chapter in this page.
Variables syntax
Each variable needs three attributes separated with | (pipe) character. These attributes (in correct order) are variable name in code,variable description in wiki page and default value. Variable triplets must also be separated with pipe. An example R code with two defined attributes calculates the area of a rectangle:
<rcode variables="width|Width of the rect|10|height|Height of the rect|10"> # The area of the rect is width * height </rcode>
Note that variable default value can also be a string or even an array (e.g. c(1,2,3) or 'Some name').
Rationale
See also
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>