Loading...
 
Skip to main content

History: PluginR

Source of version: 99 (current)

Copy to clipboard
            See also [http://r.tiki.org|r.tiki.org]

{DIV(float=>right)}{img src=http://www.r-project.org/Rlogo.jpg class=reflect link=http://www.r-project.org}{DIV} 
! Plugin R
This ((Wiki Plugins)) provides an interface to run R scripts through web pages. 

PluginR allows basic and direct usage, writing the script between the PluginR tags (see below), but it also allows advanced usage, where ((Pretty Trackers)) can be used to make web interfaces to modify the parameters that you want to allow the user to modify before producing the text or graphic output from your scripts. Or you can send full data files to your R script to be processed and get the output automatically on-line a few seconds later. This way, Tiki and PluginR become a nice and collaborative web interface for your custom R scripts. 

{REMARKSBOX()}Up to ((Tiki17)) you needed to install this plugin separately from Tiki through ((Mods)). Starting in ((Tiki18)), some plugin parts were rewritten to avoid former license incompatibilities with Tiki, so that it is bundled within the main Tiki code base, and no extra installation is needed for PluginR to work, aside of the R engine in the server, as usual. 
{REMARKSBOX}


{SPLIT()}
{img src=display1111 imalign=center width=300}
---
{img src=display595 width=225}
---
{CENTER()} {youtube movie="https://www.youtube.com/watch?v=lVKMsaWju8w" privacyEnhanced="n" width="300" height="200" quality="high" allowFullScreen="y" related="y"}{CENTER}
{SPLIT}


{REMARKSBOX(type="note" title="Is this your first time to R or Tiki?" highlight="y")}
__New to R?__
R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. R needs to be installed separately in your server for ((PluginR)) to work, of course.

For more information, see: [http://www.r-project.org]. 

__New to Tiki?__
Tiki is a Tightly Integrated Knowledge Infrastructure, which allows you to create almost any kind of web environment for your project. As far as R is involved, it allows you to run R scripts in web pages and edit them easily at any time (it's based on a wiki engine). And it also allows you to create web interfaces for your R scripts and packages (you'll see some examples linked below).

To run Tiki you need:
# A XAMP  stack (Linux/Mac/Windows + __A__pache web server + __M__ysql database server + __P__HP programing language). As a reference, see how to install it on a ((Ubuntu)) GNU/Linux ((Ubuntu Install|here))
# Install Tiki on that server. See: ((Installation))
# If you run a Tiki version earlier than ((Tiki18)), you need to install PluginR in place, as admin, through the [tiki-mods.php] interface once inside your own Tiki, or by hand getting the PluginR code from http://mods.tiki.org 
# Have R working in the same server where your Tiki is installed.

In addition, you can apply some Tiki Configuration Profile from [https://profiles.tiki.org]:
* __R_demo__: a ((Profile)) called [https://profiles.tiki.org/R_demo|R_demo] to check whether all features are working in your server, and which params might be useful to fine tune the output that you will get from the R scripts you write in your server according to your needs. 
+ http://profiles.tiki.org/R_demo
+ Some screenshots of the former profile __R_Heatmap__after being applied to your tiki site:
++ || {img fileId="629" thumb="y" rel="box[g]" width="350"} | {img fileId="630" thumb="y" rel="box[g]"  width="350"} ||

{REMARKSBOX}

!! Try it at r.tiki.org
Try it here: [https://r.tiki.org]

!! Installation (if Tiki < 18)
This plugin is not installed by default in Tiki until ((Tiki18))  (it was GPL licensed before then, while Tiki is LGPL licensed), therefore for Tiki versions earlier than 18, you can obtain it from [http://mods.tiki.org|Mods]. 

You can see the details of the last version here:
[http://mods.tiki.org/details.php?type=wikiplugins&mod=r|http://mods.tiki.org/details.php?type=wikiplugins&mod=r|box]

And you can fetch it from a link like (being X.YY the latest version of the plugin; e.g. 0.70):
[http://mods.tiki.org/Dist/wikiplugins-r-X.YY.tgz]

See the ((Mods|documentation about Mods)) to see how to manually install a Mod in your Tiki site.

In its current design, it will only work in Unix-like environments, such as GNU/Linux and others. It comes with two plugin files (wikiplugin_r.php and wikiplugin_rr.php), and one .htaccess file to allow writing .png files (for charts and figures) at the ./temp folder in tiki.

__Please note:__ you will need to have the php function ''exec'' enabled on your server to run wikiplugin_rr.php

Additionally, you might want to install the "geshi" program in your tiki file tree (as explained in ((PluginCode)) ), so that you can get color highlighting when documenting bits of R syntax inside PluginCode calls. Since ((Tiki7)) you can alternatively enable the feature "Syntax highlighting" (codemirror) bundled within Tiki in order to get this result and also syntax highlighting while in edit mode. See ((Syntax Highlighter))

!! Requirements
The R package and imagemagick installed in the server. On GNU/Linux and similar systems, you can install the base packages with something like:
{CODE(colors=bash)}sudo apt-get install r-base r-base-dev r-recommended imagemagick{CODE}
or 
{CODE(colors=bash)}yum install R R-devel R-lattice imagemagick{CODE}
depending on the GNU/Linux distribution that you use.

If you see an error message saying something about an error when attempting to __convert...__, then you need to ensure that you installed the system package imagemagick, that will be needed for image conversion server side in R.

Once all requirements are installed, you can start the R console in a terminal by typing "R".

{REMARKSBOX()}
You might need some extra R packages in your R installation, depending on the type of analysis that you want R to perform for you. 

For instance, depending on which R packages you want to use, you might need to install these system packages additionally, in order to have the other specific packages working (from debian GNU/Linux system, or similar name under other GNU/Linux distributions)
{CODE(colors="shell", line="1", caption="In Ubuntu 10.04 LTS Server")}
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz4 libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev 
{CODE}

{CODE(colors="shell", line="1", caption="In Ubuntu 12.04 LTS Server")}
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk
{CODE}

{CODE(colors="shell", line="1", caption="In Ubuntu 14.04 LTS Server")}
sudo apt-get install r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk libgtk2.0-dev libglpk-dev libnetcdf-dev netcdf-bin netcdf-doc  libv8-dev r-cran-rjava libmpfr-dev libc6-i386 libssl-dev r-cran-plyr r-cran-rmysql
{CODE}

{CODE(colors="shell", line="1", caption="In Ubuntu 16.04 LTS Server")}
sudo add-apt-repository -y ppa:marutter/rrutter
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable # Needed for R package tmap
sudo add-apt-repository -y ppa:opencpu/jq # Needed for R package tmap
sudo apt-get install -y  r-recommended  r-cran-xml libgraphviz-dev libcairo2-dev r-cran-cairodevice freeglut3 freeglut3-dev r-cran-rglpk r-cran-rgl r-cran-misc3d libx11-dev libxt-dev libcurl4-gnutls-dev libxml2-dev r-cran-xml libgraphviz-dev libcairo2-dev bwidget tk-table libv8-dev r-cran-rjava libmpfr-dev libc6 libssl-dev libx11-dev libxml2-dev libxml2:i386 libxt-dev r-cran-misc3d unaccent xvfb libgdal1-dev libproj-dev r-cran-rmysql libmagick++-dev r-cran-rcolorbrewer r-cran-doparallel libssh2-1-dev libudunits2-dev libgdal-dev libgeos-dev libproj-dev libjq-dev libprotobuf-dev protobuf-compiler libssl-dev libcairo2-dev
{CODE}

Of course you can use some nice GUI programs on top of R, like the nice multiplatform RStudio ([http://www.rstudio.net]), or others.
{REMARKSBOX}

For MS Windows-based OS, you need to ensure that you have imagemagick successfully installed in your system. See these urls for help:
* http://www.zoharbabin.com/5-steps-to-get-imagemagick-on-xampp-1-7-3
* http://bytehash.appspot.com/2012/02/Installing-imagick-for-php-in-windows-under-xampp


!! Usage and Parameters
To use this plugin in a wiki page, use the syntax:
{CODE(caption=>Syntax for the R plugin, wrap=>1, ishtml=>0)}
{R()} your R script here {R}
{CODE}

or 

{CODE(caption=>Syntax for the R plugin, wrap=>1, ishtml=>0)}
{RR()} your R script here which might use some potentially dangerous commands in the server, once that plugin call is validated by an admin{RR}
{CODE}

!!! Plugin R vs Plugin RR
Since version 0.5.1 from this mod, you can use plugin rr to execute as admin unsafe commands: you will be required admin validation of those plugin calls.

With plugin r, you will not be requested plugin validation, instead, but unsafe commands will be blocked.
 

!!! Parameters

You can add some optional parameters to the PluginR call:
{pluginmanager plugin="r"}

!!! Display several graphs in the same Plugin R call

Since PluginR version 0.72, a user can create and display several png's within the same PluginR call, provided that the user writes 

{CODE()}
# newgraph
{CODE} 

before the new graph so that pluginR opens up the required new graphic device.

!!! Set a CRAN mirror in your R call
You can setup a CRAN mirror in your R call at the wiki page level, by means of using this code:
{CODE()}
r <- getOption("repos")
r["CRAN"] <- "http://ftp.heanet.ie/mirrors/cran.r-project.org/"
options(repos=r)
{CODE}

Replace "http://ftp.heanet.ie/mirrors/cran.r-project.org/" with your local CRAN mirror.

!!! Find results through the tiki search
Tiki is able to index the results from plugin R. You just need to add "r" and "rr" in the list of plugins to be indexed their contents (which also indexes their results)

You can do so in the __Search Control Panel__ (tiki-admin.php?page=search): 
* __Exclude all plugins__: (__X__)
* __Except included plugins__: __r,rr__,andAllYourPluginsOfInterest
** for example: "fancytable,list,trackerlist,trackerfilter,code,box,remarksbox,quote,fluidgrid,split,r,rr"

And you need to reindex your site. The option in the search control panel __Incremental Index Update__ might not be enough, you might need to run a full __Rebuild index__ by the Search Control Panel or through a ((Console|console command)) ( -+php console.php i:r+- ).

!! Examples

!!!# Example 1: simple command

__Direct output__
''This code,''
{CODE(colors=python)}
{R()}1:25{R}
{CODE}

''Would produce:''
{QUOTE()}~np~
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
~/np~{QUOTE}

!!!# Example 2: a simple graph
{CODE(colors=python)}
{R()}
x <- 1:10;
y <- (1:10)^2;
plot(x,y);
{R}
{CODE} 
 

!!!# Example 3
Opening a file from a tracker item attachment and let the R script use it, showing the output in the wiki page. 

http://www.geography.uoregon.edu/GeogR/topics/examplesession.htm

Get this file __sumcr.csv__ as example:
[http://www.geography.uoregon.edu/GeogR/data/csv/sumcr.csv] 

When opened in a text editor, it should look like (with 89 lines, instead of just those following 4):
{CODE(colors=python)}
Location,Reach,HU,CumLen,Length,DepthWS,WidthWS,WidthBF,HUAreaWS,HUAreaBF,wsgrad
HUA-1,A,R,9.20,9.20,0.12,4.10,9.00,37.72,82.80,0.008696
HUA-2,A,G,29.70,20.50,0.21,3.98,9.63,81.66,197.48,0.002927
HUA-3,A,R,51.20,21.50,0.10,4.46,11.43,95.83,245.75,0.001395
...
{CODE}

Upload this file as an attachment to a ((Trackers|Tracker item)).

!!!!# 3a: attId hardcoded
Create a wiki page with a call to the PluginR, setting the attId in the appropriate param of the plugin.
In this example, let's say that the attId is number 2.

attId=2. csv file with csv extension. data separated with commas

{CODE(colors=Python)}
{R(attId=2)}summary(data)
{R}
{CODE} 
The data in that csv file has been assigned to the variable __data__ in the pluginR.
Thus, __summary(data)__ will produce the summary of the variables and data included in that csv file. 

Output produced:
{CODE(colors=python)}
    Location  Reach  HU         CumLen          Length          DepthWS      
 HUA-1  : 1   A:20   G:27   Min.   :  9.2   Min.   : 1.800   Min.   :0.0900  
 HUA-10 : 1   B:46   P:22   1st Qu.:234.6   1st Qu.: 5.675   1st Qu.:0.1500  
 HUA-11 : 1   C:22   R:39   Median :454.8   Median : 8.800   Median :0.2000  
 HUA-12 : 1                 Mean   :440.0   Mean   : 9.953   Mean   :0.2208  
 HUA-13 : 1                 3rd Qu.:616.9   3rd Qu.:13.000   3rd Qu.:0.2700  
 HUA-14 : 1                 Max.   :835.0   Max.   :27.300   Max.   :0.5100  
 (Other):82                                                                  
    WidthWS         WidthBF          HUAreaWS        HUAreaBF     
 Min.   :1.160   Min.   : 3.700   Min.   : 4.95   Min.   : 13.32  
 1st Qu.:2.520   1st Qu.: 7.253   1st Qu.:15.78   1st Qu.: 51.18  
 Median :3.065   Median : 8.700   Median :28.62   Median : 77.70  
 Mean   :3.159   Mean   : 8.929   Mean   :31.89   Mean   : 89.43  
 3rd Qu.:3.862   3rd Qu.:10.312   3rd Qu.:38.66   3rd Qu.:110.95  
 Max.   :5.300   Max.   :19.300   Max.   :95.83   Max.   :295.00  
                                                                  
     wsgrad          
 Min.   :-4.091e-02  
 1st Qu.:-2.925e-05  
 Median : 7.549e-03  
 Mean   : 8.769e-03  
 3rd Qu.: 1.465e-02  
 Max.   : 7.100e-02  
{CODE}                    

!!!!# 3b: attId dynamically referenced 
A page A with a ((PluginTrackerList)) lists items from a tracker with the param link=y. The url param has to be like: url="tiki-index.php?page=B&itemId", where __B__ here stands for the wiki page containing the plugin R call. 

When the users click on the link of an item, they are sent to wiki page B, with an url containing the Id number of that traker item selected. PluginR gets then the attachment id of that tracker item, in order to use it to populate the variable "data".

The syntax, in this other example, is as follows:

{CODE(colors=python)}
{R(attId)}summary(data)
{R}
{CODE} 

The same output should be produced as in the previous example 2a.

However, right now, if there is not itemId passed through the url, the R plugin runs and shows some output error on the wiki page.

To see this example in action, install the Profile http://profiles.tiki.org/r_test

!!!# Example 4: producing graphs
{CODE(colors=python)}
{R(attId=2)}
x <- t(data[4]);
y <- t(data[5]);
plot(x,y);
{R}
{CODE} 
 
{img src="http://dev.tiki.org/img/wiki_up/pluginR_sample_plot_00.png" align=center}

!!!# Example 5: adding params to the graphs

To see this example in action, install the Profile http://profiles.tiki.org/r_test

{SPLIT(fixedsize=>n)}
-= ::res 72 dpi:: =-
!!!!# Using default: res 72, pointsize 12,
Width 500px and rest by default: res 72, pointsize 12, bg "transparent"

This code:
{CODE(wrap=>1, colors=python)}
^{R(width=500)}data(cars)
plot( cars$dist ~ cars$speed )
title('By default, res 72, pointsize 12,\n bg transparent')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
{CODE}

Produces:

{img fileId="264" alt="" rel="box[g]"} 

---
~hs~
---
-= ::res 120 dpi:: =-
!!!!# res 120 & pointsize 12 & bg yellow
If not pointsize is set, default value (12) is used.

This code:
{CODE(wrap=>1, colors=python)}
^{R(width=500 res=120 units=px bg=yellow)}data(cars)
plot( cars$dist ~ cars$speed )
title('res 120 & pointsize 12 \n bg yellow')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
{CODE}

Produces:

{img fileId="266" alt="" rel="box[g]"} 

@@@
!!!!# res 72 & pointsize 16

This code:
{CODE(wrap=>1, colors=python)}
^{R(width=500 res=72 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('res 72 \n pointsize 16')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
{CODE}

Produces:

{img fileId="265" alt="" rel="box[g]"} 

---
~hs~
---
!!!!# res 120 & pointsize 16

This code:
{CODE(wrap=>1, colors=python)}
^{R(width=500 res=120 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('res 120 \n pointsize 16')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
{CODE}

Produces:

{img fileId="267" alt="" rel="box[g]"} 

{SPLIT}

!!!# Example 6: edit R params through Pretty Trackers
What are "__Pretty Trackers__" in the Tiki context? 
See this page: ((Pretty Tracker))


And to see this example in action, for the time being, install the Profile http://profiles.tiki.org/r_test

!!!# Example 7: showing results in html
!!!!# Using html tags
This code:
{CODE(colors=python)}
{R()}print("<b>hello</b>"){R}
{CODE}

Produces:

 [[1] "__hello__"

!!!!# Using wikisyntax param: no param set

This code:
{CODE(colors=python)}
{R()}print("__hello__"){R}
{CODE}

Produces:

 [[1] "~np~__hello__~/np~"

!!!!# Using wikisyntax param set to 0

This code:
{CODE(colors=python)}
{R(wikisyntax=>0)}print("__hello__"){R}
{CODE}

Produces:

 [[1] "~np~__hello__~/np~"

!!!!# Using wikisyntax param set to 1

This code:
{CODE(colors=python)}
{R(wikisyntax=>1)}print("__hello__"){R}
{CODE}

Produces:

 [1] "__hello__"


!!!# Example 8: using potentially dangerous commands
As an admin you can execute any R command to the server. Just plugin __rr__ instead, and validate your plugin calls as needed. 

Normal users don't have the ability to validate plugin calls, so that they can only execute safe R commands in the server. 

!!!# Example 9: loading and saving the R workspace
By default Plugin R runs in --vanilla mode, so that no workspace is loaded at the beginning nor saved at the end, and no human intervention is expected to run the R commands, nor echo's from the R console are printed.

However, for some use cases, you may need to save the R objects and data from your session (call to PluginR) and re-use it afterwards in a new PluginR call, in the same wiki page or others. 

!!!!# In the same wiki page
If you have more than one call to PluginR in the same wiki page, you can use the param. __loadandsave__ to force R to load any existing workspace data for that wiki page and save it at the end again.

For instance, for a Wiki page called "__My Test__", you would have your workspace data stored in your server at:

{CODE()}
./temp/cache/My_Test/.RData
{CODE}

Note that spaces in names are replaced by the underscore sign ("_"). Therefore, the equivalent page with name "My_Test" (with the underscore instead of the space) would be using the same workspace data. 

Example:

{img src="display468" class=reflect }

!!!!# Across diferent wiki pages
In this case, we assume that all wiki pages involved in your R calls are a set of scripts that can be run for multiple analysis on one or more of your r scripts. This way, we'll use the  ((Trackers)) feature, which will serve as a database engine to keep track of all our analysis projects, with the addition to keep the same workspace data among all pages related to the same project.

Therefore, as far as the itemId param is used in the urls sent between wiki pages (by means of ((PluginTrackerList)), or other tracker-related plugins), the same workspace will be used even if different wiki pages are involved. 

Workspace data is stored under the ./temp/cache/ directory. E.g., for project with itemId 33, the workspace will be saved at:
{CODE()}
./temp/cache/_itemid_000033/.RData
{CODE}

!! Current limitations
# When you use PluginR combined with ((PrettyTrackers)) for advanced reporting somehow similar to what you can achieve with "Sweave & latex" (e.g. using ((Smarty templates)) in Tiki):
**  angle brackets (i.e.: ~np~ { lines of code } ~/np~) have to surrounded by smarty "literal" tags. For instance, in order to get this if clause working in a smarty template:
++ {CODE(colors=rsplus)}
if (a == 0) { 
  # line 1 of R code
  # line 2 of R code...
} {CODE}
++ you have to use this code:
++ {CODE(colors=rsplus)}
if (a == 0) {literal} { {/literal} 
  # line 1 of R code
  # line 2 of R code...
{literal} } {/literal}
{CODE}
# Installation of R packages in a server behind a proxy needs the user to export the environment variables for the proxy previous to any action attempting to connect to internet (installing r packages, etc). 
** You can alternatively install whatever R packages you need through a standard console/ssh (by yourself or after requesting it to the sysadmin in your server), after adding the proxy info to the Renviron file in your operating system. 
++ You can also try adding this type of line at the beginning of your R script:
++ {CODE()}Sys.setenv(http_proxy="http://your_proxy_url:8080"){CODE}

__Former limitations fixed__
There were some former limitations when using R code in smarty syntax through wiki pages as templates for ((PluginTrackerList)):
* double parenthesis parsed as internal or alias links,
* square brackets parsed as external links,
* double pipes for OR. 

But these one have been fixed by using a new param created in PluginTrackerList in Tiki 6.4 and Tiki 7.1:
* param "__tplwiki__"
+ which prevents parsing of R code by smarty: only {$f_1} type of fields are converted into their equivalent data from the corresponding field 1, etc.

!! Tips
__Some useful tips for advanced usage__:
# When using ((PluginTrackerList)) calls, remember to keep param __showlinks="0"__ to rpevent that Main tracker fields (those who will be linked to the tracker item) are rendered as html links, which R would not like in many cases.
+ ~hs~
# When using tracker fields of type "textarea" (lets say for tracker field 1 ({$f_1})), and attempting to show them in a command like remember to surround the tracker field reference with double quottation, like: 
+{CODE()}
cat("{$f_1}")
{CODE}
+ because if you have more than one line, if you don't surround that field with double quotation marks, R doesn't know that the next line is still from the previous "cat" command.
+ ~hs~
# [http://www.smarty.net/docsv2/en/language.builtin.functions.tpl#language.function.capture|smarty language function capture] can be very handy to add smarty logic based on some values of a tracker item field. Example:
+ {CODE(colors="r")}
{capture name='saveas'}{$f_46}{/capture}
  {if $smarty.capture.saveas eq "PDF"}
      {wikiplugin _name=rr loadandsave=1 pdf=1 svg=0}
        cat("f_46 is {$f_46}");
        # Do your stuff here with pdf button generation...
      {/wikiplugin}
  {elseif $smarty.capture.saveas eq "SVG"}
      {wikiplugin _name=rr loadandsave=1 pdf=0 svg=1}
        cat("f_46 is {$f_46}");
        # Do your stuff here with svg button generation...
      {/wikiplugin}
  {else}
      {wikiplugin _name=rr loadandsave=1 pdf=0 svg=0}
        cat("f_46 is {$f_46}");
        # Do your stuff here with no pdf nor svg buttons...
      {/wikiplugin}
  {/if}
{CODE}
+ ~hs~
# To create and display several png's in the same PluginR call, write 
+ {CODE()}
# newgraph
{CODE}
+ before the new graph so that pluginR opens up the required new graphic device.
+ ~hs~
# When using data in R from file attachments to tracker items, you can use the following R session variables to display that content, if desired, from R 
** -+file_type+-  for filetype
** -+data_file+- for path and file name (usually in tmp folder on disk when used by php), 
** -+data+- for the contents of that file
+ ~hs~
# When used in conjunction with ((Trackers)):
** you would usually call PluginR from ((PluginTrackerList)) using the wikitpl parameter to indicate to use a custom smarty template stored in a wiki page within Tiki itself. 
++
** However, in some cases, you might need to do some R magic in the form to insert the data (created using ((PluginTracker)) and the parameter "wiki" to set it to use a wiki page as template for the custom display of that form. Therefore, when you use that form to edit the values in the fields of the tracker item, you can display some advanced calculations, or charts based on values stored in previous fields, etc. 
++
++ In such scenario, you need to add the "output" smarty modifier so that the field is not passed to R s a piece of html form to insert values, but as the raw values stored in the field, so that R can use them properly.  
++
++ Therefore, if __{$f_1}__, and __{$f_2}__ are a numeric tracker fields, if you want to display a form to insert data, you would use in the wiki page containing the smarty template, as usual: 
++ {CODE(colors="r")}
MyField1: {$f_1}
MyField2: {$f_2}
{CODE}
++
++ however, if you want to display in a later stage for that tracker item (for instance, when showing the form to enter data for field 3), a calculation based on fields 1 and 2, you will need to use them as __{$f_1|output}__ and __{$f_2|output}__ respectively, to pass the values to R properly:
++ {CODE(colors="r")}
MyField3: {$f_3}
(Remember that MyField1 times MyField2 was {wikiplugin _name=rr}
field1 <- "{$f_1|output}"
field2 <- "{$f_2|output}"
myRformula <- field1 * field2
cat(myRformula)
{/wikiplugin} )
{CODE}
++ Keep in mind, though, that for not too complicated calculations and algorithms, you can use the ((Mathematical Calculation Tracker Field)) with the ((Calculations)) syntax, and you do not need to follow the PluginR way. But for more advanced use cases and formula/calculations/algorithms needed, you can use the power of R this way. (:wink:)
!! External sources of information
!!! Related presentation at UseR! 2011
::UseR! 2011: [http://www.warwick.ac.uk/statsdept/user-2011/]::

{CENTER()}{HTML()} <iframe src="//www.slideshare.net/slideshow/embed_code/key/Cm1PhP4hclYdA4" width="595" height="485" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC; border-width:1px; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe> <div style="margin-bottom:5px"> <strong> <a href="//www.slideshare.net/ueb52/2011-use-rtikipluginr" title="2011 use r_tiki_pluginr" target="_blank">2011 use r_tiki_pluginr</a> </strong> from <strong><a href="https://www.slideshare.net/ueb52" target="_blank">VHIR Vall d’Hebron Institut de Recerca</a></strong> </div>
{HTML}{CENTER} 

!!! Discussion Forums
* __English__: http://tiki.org/forum24
* __Spanish__: http://r-es.org/forum3
 

!!! Publications
There are some publications/communications already based on the usage on Tiki & PluginR in different scientific fields:

* 2012. Taller 3:''Interfaces Web 2.0 para R con Tiki''. [http://r-es.org/IV+Jornadas|IV Jornadas de usuarios de R]. Barcelona, Catalonia (Spain). Thursday 15/11/12, 18:15-20:00:
** Information & Video: http://r-es.org/item255?page=IV+Jornadas

* 2012. "''Deploying a tools website in a Bioinformatics unit with Tiki & PluginR''". de Pedro, X.; Briansó, F.; Sánchez. A.  [http://sgt.cnag.cat/jbi2012/?p=1|XIth Spanish Symposium on Bioinformatics] (JBI2012).  Spanish Institut of Bioinformatics and the Portuguese Bioinformatics Network and hosted by the Barcelona Biomedical Research Park (PRBB). Barcelona, Catalonia, Spain. January 23-25. PDF: 
** Full text: http://sgu.bioinfo.cipf.es/jbi2012/wp-content/uploads/2012/01/JBI2012_BookAbstracts_r.pdf
** Poster: http://ueb.vhir.org/dl323

* 2011. "''Tiki + PluginR en 2011: interfaces web más fáciles para R''". Xavier de Pedro, Ferran Briansó, Àlex Sánchez. [http://www.r-es.org/III+Jornadas|III Jornadas de usuarios de R]. Madrid (España). November 18th.
** Communication Text & Video: http://ueb.vhir.org/tools/2011+III+Jornadas+R
** Slides: http://ueb.vhir.org/tools/show:2011+III+Jornadas+R

* 2011. Taller 5:''Crea interfaces Web 2.0 a tus programas en R con software libre (LAMP + Tiki + PluginR)''. [http://www.r-es.org/III+Jornadas|III Jornadas de usuarios de R]. Madrid (España). Friday 18/11/11, 12:30-14:30h:
** Information: http://www.r-es.org/Taller+5
** Documentation & Screenscasts: http://ueb.vhir.org/2011+R-es+Taller+5 

* 2011. "''Web 2.0 for R scripts & workflows: Tiki & PluginR''". Xavier de Pedro & Àlex Sánchez. The R User Conference 2011. University of Warwick, Coventry, UK. August 16-18th. http://ueb.vhir.org/2011+UseR

* 2010. "''Usando de forma segura R vía web con Tiki''". Xavier de Pedro y Àlex Sánchez. I Congreso de usuarios de R (II Jornadas). Mieres (Oviedo, España). 1-2 de Diciembre de 2010. PDF (in Spanish): 
** Full text: http://estbioinfo.stat.ub.es/wp-content/uploads/2010/12/RJ-II-Jornadas-R-ES-XavierdePedro.pdf 
** Slides: http://estbioinfo.stat.ub.es/wp-content/uploads/2010/12/RJ-II-Jornadas-R-ES-XavierdePedro_diapos_v3.pdf

* 2010. "''Using R in Tiki for Bioinformatics''". de Pedro, X.; Sánchez. A.  [http://www.bitlab-es.com/jbi2010|Xth Spanish Symposium on Bioinformatics] (JBI2010) (Malaga, Spain. 27-29 October 2010). PDF: 
** Full text: http://estbioinfo.stat.ub.es/wp-content/uploads/2010/09/jbi2010_attachment_64_v3.pdf
** Poster: http://estbioinfo.stat.ub.es/wp-content/uploads/2010/09/jib2010_poster_Using_R_in_Tiki_v02.pdf

* 2010. "''Assessing Student Activity Through Log Analysis From Computer Supported Learning Assignments''". X. de Pedro, M. Calvo, A. Carnicer, J. Cuadros, A. Miñarro. In International Congress of University Teaching and Innovation - CIDUI 2010, Barcelona July 2010. --http://cochise.bib.ub.es-- http://cochise.seeds4c.org


-=References and links=-
* R-project: http://www.r-project.org
* R Tiki Training site: https://r.tiki.org
* Tiki Configuration profiles: 
** [http://profiles.tiki.org/r_test]
** [http://profiles.tiki.org/R_HeatMaps]
* dev: [http://dev.tiki.org/PluginR] 
* Sponsorship:
** Statistics and Bioinformatics Unit. Vall d'Hebron Research Institute (UEB-VHIR). Barcelona, Catalonia, Spain. [http://ueb.vhir.org]
** EiB group: Estadística i Bioinformàtica, Dept. of statistics, University of Barcelona, Catalonia, Spain. [http://estbioinfo.stat.ub.es]
** Cochise project  - REDICE - University of Barcelona- --[http://cochise.bib.ub.es]-- Copy of Conference Communication  and working demo at http://cochise.seeds4c.org 


-=alias=-
(alias(Plugin R)) | (alias(PluginRR)) | (alias(Plugin RR)) | (alias(R))