Loading...
 
Skip to main content

History: Profile_r_test13_parse_body

Source of version: 7

Copy to clipboard
            ! Unfinished work. Alfa state.

This page first of all produces a simple barchart using conventional R body content ie with

!!- Barplot
{R(bg="yellow")}
abundance <- matrix(c(8, 4, 7),ncol=3,byrow=TRUE);
colnames(abundance) <- c("Jan","Feb","Mar");
rownames(abundance) <- c("total abundance");
abundance;
barplot(abundance);
{R}

!!- Using Ajax services
http://localhost/tiki-ajax_services.php?controller=tracker&action=export_items&trackerId=2&encoding=UTF-8&separator=%2C&delimitorL=%22&delimitorR=%22&CR=%25%25%25&listfields[]=9&listfields[]=10&recordsMax=-1

!!- Using sjPlot
{RR(bg="yellow" parse_body="n" echodebug=1)}
r <- getOption("repos")
r["CRAN"] <- "http://ftp.heanet.ie/mirrors/cran.r-project.org/"
options(repos=r)
install.packages("sjPlot")
library("sjPlot")


#####EXAMPE from elsewhere
marca<-c("opel","renault","renault")
model<-c("corsa","laguna","modus")
cilindrada<-c(1.2,1.9,1.5)
color<-c("blanc","vermell","violeta")
cotxes<-data.frame(marca,model,cilindrada,color)
cotxes

# load libraries
library(sjPlot)
library(sjmisc)
# init default theme for plots
sjp.setTheme(geom.label.size = 2.5, axis.title.size = .9, axis.textsize = .9)
sjp.frq(cotxes$marca)
sjp.frq(cotxes[,1])
{RR}

See:
* https://strengejacke.wordpress.com/2013/07/17/plotting-likert-scales-net-stacked-distributions-with-ggplot-rstats/
* http://strengejacke.de/sjPlot/custplot/


!! Using TrackerList
__Wiki a wiki template__
{trackerlist trackerId=2 fields="9:10:11" list_mode=csv max=4 showpagination="n" tplwiki=r_demo13_template01}

__Without a wiki template, and with param list_mode=csv__
{trackerlist trackerId=2 fields="9:10:11" list_mode=csv max=4 showpagination="n"}

__With a wiki template, and without param list_mode=csv__
{trackerlist trackerId=2 fields="9:10:11" max=4 showpagination="n" tplwiki=r_demo13_template01}

See bug report related to param list_mode=csv
"plugin trackerlist param list_mode=csv does nothing for me" - https://dev.tiki.org/item5688

!! R
{R(bg="yellow" parse_body="y" echodebug=1)}
abundance <- matrix(c({trackerlist trackerId=2 fields="9:10:11" list_mode=csv max=4 showpagination="n" tplwiki=r_demo13_template01}),ncol=3,byrow=TRUE);
abundance;
barplot(abundance);
{R}
In the above the echodebug now shows the body content both pre and post parsing so that it can be checked.


So now that you can generate output from a tracker using a trackerlist plugin, or for more flexibility using the list plugin, then a lot more options become possible with R   :-)

        

History

Information Version
Wed 20 of Jan, 2016 16:24 GMT-0000 Xavi (as xavidp - admin) updated info in a quick & dirty way 17
Wed 22 of Jul, 2015 12:12 GMT-0000 Xavier de Pedro rpivotTable 16
Wed 22 of Jul, 2015 09:34 GMT-0000 Xavier de Pedro qdap desc 15
Wed 22 of Jul, 2015 08:56 GMT-0000 Xavier de Pedro stringr added 14
Wed 22 of Jul, 2015 08:55 GMT-0000 Xavier de Pedro adding info of r package to get counts from the data frame so that graphs of frequencies can be produced with sjp.frq 13
Tue 21 of Jul, 2015 15:05 GMT-0000 Xavier de Pedro updated code - work in progress 12
Tue 21 of Jul, 2015 14:52 GMT-0000 Xavier de Pedro cleaning up and updating info about how to use (in this alpha stage) 11
Tue 21 of Jul, 2015 14:44 GMT-0000 Xavier de Pedro cleaning up 10
Tue 21 of Jul, 2015 14:42 GMT-0000 Xavier de Pedro re-organize page 9
Tue 21 of Jul, 2015 14:39 GMT-0000 Xavier de Pedro improved example with a working procedure to fetch the tracker data to an r object without using a custom wiki smarty template 8
Tue 21 of Jul, 2015 12:02 GMT-0000 Xavier de Pedro added link to bug report 7
Tue 21 of Jul, 2015 12:00 GMT-0000 Xavier de Pedro added a few commands from sjPlot 6
Tue 21 of Jul, 2015 11:58 GMT-0000 Xavier de Pedro translated 5
Tue 21 of Jul, 2015 10:33 GMT-0000 Xavier de Pedro tweaked 4
Fri 12 of Jun, 2015 22:48 GMT-0000 Xavier de Pedro added note about sjPlot 3
Fri 12 of Jun, 2015 07:11 GMT-0000 Xavier de Pedro added tip about ajax services 2
Mon 08 of Jun, 2015 21:47 GMT-0000 Xavier de Pedro ini, from geoff 1