History: Profile_r_test1_simple_test
Preview of version: 9
Simple R commands to test that the installation went fine
Produces:
Produces:
Produces:
Will produce:
Once validated, it will show something like this (the fist time when the package was not installed yet):
Or if we do't want to show the warning messages of the package loading on the wiki page, we can call the loading of the library with:
Therefore, this:
Will produce this other output:
(nothing)
Produces:
Produces:
Produces:
And once everything is ready in your system (all packages installed, etc), you'll see something like this:
Text output
This code:Copy to clipboard
{R()}1:10{R}
Produces:
Plugin disabled
Plugin r cannot be executed.
1.2. Simple Graphical output
This code:Copy to clipboard
{R()}plot(1:10,11:20){R}
Produces:
Plugin disabled
Plugin r cannot be executed.
1.3. Basic image with svg and pdf export
This code:Copy to clipboard
{R(svg="1", pdf="1")}x<-c(1:10) y <- x*x plot(x,y) {R}
Produces:
Plugin disabled
Plugin r cannot be executed.
Calling commands with admin validation (like install.packages, etc)
This command will attempt to install an R package, and it will require from an admin validation before it can be run from Tiki to the R server behind:Copy to clipboard
{RR(loadandsave="1", wikisyntax="0", removen="0")} # Example adapted from the ones shown here: http://code.google.com/p/google-motion-charts-with-r/ # and here: http://www.r-bloggers.com/interactive-reports-in-r-with-knitr-and-rstudio/ # # If required the first time, uncomment the following line/s to install the required R packages, and edit the path and url to suite your needs if(!require(googleVis)){ install.packages("googleVis", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } {RR}
Will produce:
Plugin disabled
Plugin rr cannot be executed.
Once validated, it will show something like this (the fist time when the package was not installed yet):
'googleVis.Rnw'
The downloaded source packages are in
'/tmp/RtmpbI9rP4/downloaded_packages'
The downloaded source packages are in
'/tmp/RtmpbI9rP4/downloaded_packages'
Or if we do't want to show the warning messages of the package loading on the wiki page, we can call the loading of the library with:
suppressPackageStartupMessagesgoogleVis
Therefore, this:
Copy to clipboard
{RR(loadandsave="1", wikisyntax="0")} suppressPackageStartupMessages(library(googleVis)) {RR}
Will produce this other output:
Plugin disabled
Plugin rr cannot be executed.
(nothing)
1.4. Graphical output with advanced packages
Using GoogleVis package, for instance.1.4.1. Basic chart with information shown when mousing over the points
This code:Copy to clipboard
{R(wikisyntax="0" loadandsave="1", removen="0")} require(googleVis) df <- data.frame(x = 1:10, y = 1:10) ## load the googleVis package suppressPackageStartupMessages(library(googleVis)) ## create the scatter chart sc <- gvisScatterChart(data=df, options=list(width=300, height=300, legend='none', hAxis="{title:'x'}", vAxis="{title:'y'}") ) ## print(sc, "chart") ## same as cat(sc$html$chart) {R}
Produces:
Plugin disabled
Plugin r cannot be executed.
1.4.2. Basic Geolocated Map
This code:Copy to clipboard
{R(loadandsave="1", wikisyntax="0", removen="0")} require(googleVis) geo <- gvisGeoChart(CityPopularity, locationvar = "City", colorvar = "Popularity", options = list(region="US", height=350, displayMode = "markers", colorAxis = "{colors: ['orange','blue']}") ) print(geo, "chart") {R}
Produces:
Plugin disabled
Plugin r cannot be executed.
Animated flash charts with time series data
This code:Copy to clipboard
{R(loadandsave="1", wikisyntax="0", removen="0")} require(googleVis) M <- gvisMotionChart(Fruits, "Fruit", "Year", options = list(width = 550, height = 450)) print(M, "chart") {R}
Produces:
Plugin disabled
Plugin r cannot be executed.
And once everything is ready in your system (all packages installed, etc), you'll see something like this: