History: Profile_r_test9_rcharts_highcharts
Source of version: 2 (current)
Copy to clipboard
{RR(echo="1" cacheby="pagename", caption="Example 1 with HighCharts: Several data series")} # Testing rCharts from http://ramnathv.github.io/rCharts/ if(!require(devtools)){ install.packages("devtools", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } require('devtools', quietly = TRUE ) if(!require(rCharts)){ install_github('rCharts', 'ramnathv') } h1 <- hPlot(x = "Wr.Hnd", y = "NW.Hnd", data = MASS::survey, type = c("line", "bubble", "scatter"), group = "Clap", size = "Age") #h1$print("chart5") h1$LIB[2] <- "http://{{domain}}/rcharts_libraries/highcharts" h1$save("h1.html") {RR} {CODE()} {iframe name="myChart" width="850" height="500" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/h1.html"} {CODE} {iframe name="myChart1" width="850" height="500" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/h1.html"} {RR(echo="1" cacheby="pagename", caption="Example 2 with HighCharts: BoxPlot")} # Testing rCharts from http://ramnathv.github.io/rCharts/ if(!require(devtools)){ install.packages("devtools", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/") } require('devtools', quietly = TRUE ) if(!require(rCharts)){ install_github('rCharts', 'ramnathv') } ### Simulate some data ### 3 Factor Variables FacVar1 = as.factor(rep(c("level1", "level2"), 25)) FacVar2 = as.factor(rep(c("levelA", "levelB", "levelC"), 17)[-51]) FacVar3 = as.factor(rep(c("levelI", "levelII", "levelIII", "levelIV"), 13)[-c(51:52)]) ### 4 Numeric Vars set.seed(123) NumVar1 = round(rnorm(n = 50, mean = 1000, sd = 50), digits = 2) ### Normal distribution set.seed(123) NumVar2 = round(runif(n = 50, min = 500, max = 1500), digits = 2) ### Uniform distribution set.seed(123) NumVar3 = round(rexp(n = 50, rate = 0.001)) ### Exponential distribution NumVar4 = 2001:2050 simData = data.frame(FacVar1, FacVar2, FacVar3, NumVar1, NumVar2, NumVar3, NumVar4) ### dummy variable created simData$tmpFac = "tmp" bwstats = setNames(as.data.frame(boxplot(NumVar1 ~ tmpFac, data = simData, plot = F)$stats), nm = NULL) h2 = Highcharts$new() h2$set(series = list(list(name = "NumVar1 Distribution", data = bwstats))) h2$xAxis(categories = levels(simData$tmpFac), title = list(text = "Dummy Fac Var")) h2$yAxis(title = list(text = "NumVar1")) h2$chart(type = "boxplot") h2$LIB[2] <- "http://{{domain}}/rcharts_libraries/highcharts" h2$save("h2.html") {RR} {CODE()} {iframe name="myChart" width="850" height="500" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/h2.html"} {CODE} {iframe name="myChart1" width="850" height="500" align="middle" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="temp/cache/{{domainslash_if_multitiki}}R_{{page}}/h2.html"}