Loading...
Use
Create
Develop
FAQ
Troubleshooting
History: Profile_r_test13_parse_body
View page
Source of version: 17
(current)
! Unfinished work. Alfa state. Playground with survey/questionnaire data collected through tracker forms, and displayed as survey results. You can apply the profile "Voting System" just after the R_demo profile has been applied, so that the tracker for Voting has id 2, and you will have the tracker created for you to have this example working with minimum extra clicks (until this test13 profile page is properly implemented). The fields numbered (so far only hardcoded here) as f_9, f_10 and f_11, are a few fields from the voting, that hold choices of people for a few positions in the association that does run the theoretical voting process. !!- Fetch data using TrackerList to fetch data (parse body param needed) __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} 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 :-) However, it doesn't work as of July 2015 (Tiki12). See bug report related to param list_mode=csv "plugin trackerlist param list_mode=csv does nothing for me" - https://dev.tiki.org/item5688 !!- Display dummy data using a Barplot (parse body param needed) {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. !! Fetch data using ajax services and display using sjPlot __(parse body param is NOT needed in this case, since data is fetched form custom url via web services)__. You need to grant anonymous perms to export tracker data from that specific tracker. {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") install.packages("sjmisc") install.packages("qdap") install.packages("stringr") ### EXAMPLE with pre-set data frame by hand 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 ### FETCH tracker data __using Ajax services__ Use some url such as: ^ 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&listfields[]=11&recordsMax=-1 ^ # If your tiki is not under localhost, adapt the path below for my.file my.file <- "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&listfields[]=11&recordsMax=-1" my.df <- read.csv(my.file) #colnames(my.df) <- c("f_9", "f_10", "f_11") #unlist(str_split(colnames(my.df), "\\."))[1] #str_split(colnames(my.df), "\\.")[[1]][1] # field name from f_9 in this example #str_split(colnames(my.df), "\\.")[[2]][1] # field name from f_10 in this example #str_split(colnames(my.df), "\\.")[[3]][1] # field name from f_11 in this example # 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(my.df[1]) # this fails for unknown reason str(my.df) library(stringr) my.df <- set_val_labels(my.df, c(str_split(colnames(my.df), "\\.")[[1]][1], str_split(colnames(my.df), "\\.")[[2]][1], str_split(colnames(my.df), "\\.")[[3]][1])) #summary(my.df) # Get counts from the my.df for the sjp.frq function # Maybe using rpivotTable ? # Package rpivotTable # Make Pivot Tables (as in desktop Office software) using R # See: http://www.magesblog.com/2015/03/pivot-tables-with-r.html ## Install package library(devtools) install_github("ramnathv/htmlwidgets") install_github("smartinsightsfromdata/rpivotTable") ## Load rpivotTable library(rpivotTable) data(mtcars) ## One line to create pivot table rpivotTable(mtcars, rows="gear", col="cyl", aggregatorName="Average", vals="mpg", rendererName="Treemap") # Using Package qdap: [NÒPE] # qdap: # "Quantitative Discourse Analysis Package: Bridging the Gap Between Qualitative Data and Quantitative Analysis" #library(qdap) #counts() {RR} See: * https://strengejacke.wordpress.com/2013/07/17/plotting-likert-scales-net-stacked-distributions-with-ggplot-rstats/ * http://strengejacke.de/sjPlot/custplot/
Menu
Featured profiles
Profiles in Wizard
Profiles Todos
Handlers
Profiles Tester
Admin
of this site
Current Profiles
Tiki version
21.x
24.x
25.x
26.x
27.x
Deprecated
18.x
22.x
23.x
state
Not fully functional yet
alpha
beta
release
type
Available in the Profiles Wizard (12+)
Featured profiles
Full profile (out of the box & ready to go)
Learning profile (to show off feature)
Long tail
Mini-profile (can be included in other)
Profile-snippet (optional but needs another "parent" profile)
Security
Tests
Latest Changes
Profiles_in_Wizard
Test_all_tracker_field_types
Test_All_Plugins
Testing_Aggestor
JonnyBs_Luxury_Tiki_Setup
Collaborative_Multilingual_Terminology
Profile_Test_all_Modules_Test_all_Modules_page
Revision Approval (ISO9001)
WantedPages
Kanban_Board_26
Kanban Profile Menu
Kanban-Board-26
Logging in at this site
Bug_Tracker_16
Profile_Work_Custom_Pricing_menupage_include
Bug_Tracker_16
Customer_Relationship_Management
Currency Tracker
Welcome to Tiki Profiles
Markdown_Settings
...more
Like almost all *.tiki.org sites, you can log in with your login from
https://tiki.org
(register over there)
Search
Find
Most Popular Tags
admin
agenda
alias
antibot
antibot captcha
app
archive
articles
banning
batch
blogs
calculations
calendars
cart
categories
cluster
codemirror
comments
computation
contact us
datachannel
debug
debug console
dropdown with other
error messages
features
file galleries
forums
geo
geocms
geolocation
group homepages
group watches
header
i18n
images
item link
items list
jquery
languages
location
map
maps
maths
menu
menupage
multilingual
ol3
ol5
openlayers
paypal
plugin
plugin alias
plugin datachannel
plugin fade
plugin tabs
plugin trackerlist
pretty trackers
print
project management
r
r project
realnames
rss
static
static text
statistics
stats
structures
syntax highlighter
tablesorter
template
trackers
user watches
visualization
watches
webservice
wiki
wiki argument variables
wiki structures
Tiki Newsletter
Subscribe to the Tiki newsletter.
Don't miss major announcements and other news!