Fullscreen
[Show/Hide Left Column]
[Show/Hide Right Column]

Profile_r_test2

Testing several commands, including a dynamic display of some command based on user input through 'Pretty Tracker', and usage of several graph parameters.



Test 2a - basic R command


This code:
{R()}1:10{R}


Produces:
{R()}1:10{R}


Test 2b - basic plotting


This code:
{R()}plot(1:10,11:20){R}


Produces:
{R()}plot(1:10,11:20){R}


Test 2c - dynamic variable usage


This code:
{$user}
{{user}}


Produces:
{$user}
{{user}}


Test 2d - parsing html code


This code:
{R()}cat("<b>hello</b>"){R}


Produces:
{R()}cat("<b>hello</b>"){R}


Test 2e - wikisyntax param

Attempt parsing with different values for wikisyntax param

Test 2e1 - no wikisyntax set


This code:
{R()}cat("__hello__"){R}


Produces:
{R()}cat("hello"){R}


Test 2e2 - wikisyntax set to 0


This code:
{R(wikisyntax=>0)}cat("__hello__"){R}


Produces:
{R(wikisyntax=>0)}cat("hello"){R}


Test 2e3 - wikisyntax set to 1


This code:
{R(wikisyntax=>1)}cat("__hello__"){R}


Produces:
{R(wikisyntax=>1)}cat("hello"){R}


Test 2f - using the R workspace (param. loadandsave)


a using loadandsave=1
{R(loadandsave="1")}
rm(list = ls()); 
ls();
a<-12;
cat("\na = 12\n");
{R}
{R(loadandsave="1")}
rm(list = ls());
ls();
a<-12;
cat("\na = 12\n");
{R}
b using loadandsave=1
{R(loadandsave="1")}
ls();
b<-a*3;
cat("\nb = a*3 = ");
cat(b);
{R}
{R(loadandsave="1")}
ls();
b<-a*3;
cat("\nb = a*3 = ");
cat(b);
{R}
c using loadandsave=0
{R(loadandsave="0")}
ls();
cat("\nc = b*2 = ");
c<-b*2;
cat(c);
{R}
{R(loadandsave="0")}
ls();
cat("\nc = b*2 = ");
c<-b*2;
cat(c);
{R}


This previous code should produce something like:

Image


Test 2i - pretty tracker through using param tplwiki in trackerlist


Showing R output through a Pretty tracker template saved on a wiki page (using tplwiki in plugin trackerlist, to use the content of this page r_test2_template01? as smarty template.

This code:
{tracker trackerId="$profileobject:r_test_tracker1$" url="tiki-index.php?page=r_test2"}

{TRACKERLIST(trackerId=>$profileobject:r_test_tracker1$, showlinks=>y, tplwiki=>$profileobject:r_test2_template01_page$)} 
{TRACKERLIST}


Produces:
errorPlugin disabled
Plugin tracker cannot be executed.


errorPlugin disabled
Plugin trackerlist cannot be executed.



Test 2j - plotting some other graphs with some more data and functions, with different parameters

res 72 dpi

Test 2j1 - Using default: res 72, pointsize 12,

Width 500px and rest by default: res 72, pointsize 12, bg "transparent"

This code:
^{R(width=500)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j1 - By default, res 72, pointsize 12, 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}^


Produces:
{R(width=500)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j1 - By default, res 72, pointsize 12, bg transparent')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k1 + k2*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}

 
res 120 dpi

Test 2j2 - res 120 & pointsize 12 & bg yellow

If not pointsize is set, default value (12) is used.

This code:
^{R(width=500 res=120 units=px bg=yellow)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j2 - res 120 & pointsize 12 & 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}^


Produces:
{R(width=500 res=120 units=px bg=yellow)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j2 - res 120 & pointsize 12 & bg yellow')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k1 + k2*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}

Test 2j3 - res 72 & pointsize 16


This code:
^{R(width=500 res=72 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j3 - res 72 & 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}^


Produces:
{R(width=500 res=72 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j3 - res 72 & pointsize 16')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k1 + k2*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}

 

Test 2j4 - res 120 & pointsize 16


This code:
^{R(width=500 res=120 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j4 - res 120 & 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}^


Produces:
{R(width=500 res=120 pointsize=16 units=px)}data(cars)
plot( cars$dist ~ cars$speed )
title('Test 2j4 - res 120 & pointsize 16')
m <- lm( cars$dist ~ cars$speed )
k <- coef(m)
curve( k1 + k2*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}






Contributors to this page: xavi2829 points  .
Page last modified on Sunday 07 of August, 2011 15:52:59 UTC by xavi2829 points .