Loading...
 
RR Code
# Check and Install missing packages if any
if(!require(rvest)){ install.packages("rvest", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(devtools)){ install.packages("devtools", lib="/usr/lib/R/site-library", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") }
if(!require(htmlwidgets)) devtools::install_github("ramnathv/htmlwidgets") # ::
if(!require(rpivotTable)) devtools::install_github("smartinsightsfromdata/rpivotTable") # ::
require(rvest)
require(htmlwidgets)
require(rpivotTable)

# Get the data from an internet site (or by other means in other cases)
site <- "https://dev.tiki.org/Tiki15"
file<-read_html(site)
tables<-html_nodes(file, "table")

# Data is in the only table in that page
table1 <- html_table(tables[1], fill = TRUE)
# Convert list to data frame
table1 <- as.data.frame(table1)

# Two extra commands for quick look inthe R console to the data structure and first 6 row of values. Uncomment if needed.
#str(table1)
#head(table1)

# Create the pivot table and save html on disk
#pt <- rpivotTable(table1)
pt <- rpivotTable(data = table1, rows = c("Submitted.By","Category"), cols=c("Resolution.Status","Importance"), vals = "Title", aggregatorName = "Count", rendererName = "Heatmap", width="100%", height="800px")
saveWidget(pt, file="tiki15_pivottable.html", selfcontained = FALSE)


Open PIVOT TABLE in new window
{iframe name="myChart" width="1000" height="1500" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/r.tiki.org/R_r_test15_pivottables/tiki15_pivottable.html"}



Show php error messages