Loading...
 
Skip to main content

History: Profile_r_test15_pivottables

Source of version: 2 (current)

Copy to clipboard
            {RR(echo="1" cacheby="pagename")}
# 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)
{RR}

[temp/cache/{{domainslash_if_multitiki}}R_{{page}}/tiki15_pivottable.html|Open PIVOT TABLE in new window]

{CODE()}
{iframe name="myChart" width="1000" height="800" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/tiki15_pivottable.html"}
{CODE}

{iframe name="myChart1" width="1000" height="800" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/tiki15_pivottable.html"}