Loading...
 
Skip to main content

History: Profile_r_test2_params

Source of version: 17

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

{maketoc title=""}

-==-
!! Test 2a - basic R command

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

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

-==-

!! Test 2b - basic plotting

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

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

-==-

!! Test 2c - dynamic variable usage

This code:
{CODE()}
{$user}
{{user}}
{CODE}

Produces:
{$user}
{{user}}

-==-

!! Test 2d - parsing html code

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

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:
{CODE()}
{R()}cat("__hello__"){R}
{CODE}

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

-==-

!!! Test 2e2 - wikisyntax set to 0 

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

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

-==-

!!! Test 2e3 - wikisyntax set to 1 

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

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

-==-

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

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

This previous code should produce something like:

{img src=https://doc.tiki.org/display468 imalign=center}

-==-

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

Showing R output through a Pretty tracker template (.tpl file) on disk. You need to create a tpl on disk under templates/r_test2_template01.tpl with the content that you will find at ((r_test2_template01)) wiki page.

This code:
{CODE(wrap=>1)}
{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}
{CODE}

Produces:
{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}

-==-

!! Test 2j - plotting some other graphs with some more data and functions, with different parameters
{SPLIT(fixedsize=>n)}
-= ::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:
{CODE(wrap=>1)}
^{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}^
{CODE}

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( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
---
~hs~
---
-= ::res 120 dpi:: =-
!!! Test 2j2 - res 120 & pointsize 12 & bg yellow
If not pointsize is set, default value (12) is used.

This code:
{CODE(wrap=>1)}
^{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}^
{CODE}

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( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
@@@
!!! Test 2j3 - res 72 & pointsize 16

This code:
{CODE(wrap=>1)}
^{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}^
{CODE}

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( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
---
~hs~
---
!!! Test 2j4 - res 120 & pointsize 16

This code:
{CODE(wrap=>1)}
^{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}^
{CODE}

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( k[1] + k[2]*x , from=min(cars$speed) , to=max(cars$speed) , add=TRUE ){R}^
{SPLIT}



        

History

Information Version
Fri 11 of Oct, 2013 09:00 GMT-0000 Xavier de Pedro replaced print with cat 20
Sun 24 of Mar, 2013 23:43 GMT-0000 Xavier de Pedro simplified 19
Sun 07 of Aug, 2011 15:52 GMT-0000 Xavier de Pedro updated 18
Tue 26 of Jul, 2011 21:13 GMT-0000 Xavier de Pedro oups forgot one old reference 17
Tue 26 of Jul, 2011 21:12 GMT-0000 Xavier de Pedro updated to tplwiki param for trackerlist 16
Mon 18 of Jul, 2011 08:18 GMT-0000 Xavier de Pedro added missing closing tag and mismatch in template name 15
Mon 07 of Feb, 2011 14:50 GMT-0000 Xavier de Pedro added image reference to doc.t.o 14
Mon 07 of Feb, 2011 14:48 GMT-0000 Xavier de Pedro fixed 13
Mon 07 of Feb, 2011 14:46 GMT-0000 Xavier de Pedro added a new example (with param loadandsave) 12
Mon 28 of Jun, 2010 22:03 GMT-0000 Xavier de Pedro 11
Wed 09 of Jun, 2010 09:43 GMT-0000 Xavier de Pedro 10
Wed 09 of Jun, 2010 09:39 GMT-0000 Xavier de Pedro table of 2x2 graphs with different params ('mandala'-like) 9
Wed 09 of Jun, 2010 05:58 GMT-0000 Xavier de Pedro 8
Tue 08 of Jun, 2010 15:21 GMT-0000 Xavier de Pedro added new plot with linear regression line 7
Tue 08 of Jun, 2010 07:49 GMT-0000 Xavier de Pedro 6
Mon 07 of Jun, 2010 17:16 GMT-0000 Xavier de Pedro 5
Mon 07 of Jun, 2010 17:15 GMT-0000 Xavier de Pedro renamed pages in url's or wiki or tpl params from object references to direct names 4
Sun 06 of Jun, 2010 16:29 GMT-0000 Xavier de Pedro 3
Sun 06 of Jun, 2010 16:25 GMT-0000 Xavier de Pedro 2
Fri 04 of Jun, 2010 18:11 GMT-0000 Xavier de Pedro 1