William Surles
Product Data Scientist @ Rally Software
How many lines of code did I write to make this chart?
I used R not javascript/html/css
n1 <- nPlot(y ~ x, group = , data = , type =)
shinyUI(pageWithSidebar(
headerPanel("Simple Histogram App"),
sidebarPanel(
selectInput(inputId = "n_bins",
label = "Number of bins",
choices = c(10, 20, 25, 30, 50),
selected = 20
)
),
mainPanel(
plotOutput(outputId = "main_plot")
)
))
shinyServer(function(input,output){
output$main_plot <- renderPlot({
hist(faithful$eruptions,
breaks = as.numeric(input$n_bins),
col = "green",
xlab = "Duration (minutes)")
})
})
http://shiny.rstudio.com/gallery/
require(rCharts)
require(knitr)
haireye = as.data.frame(HairEyeColor)
n1 <- nPlot(Freq ~ Hair,
group = 'Eye',
data = subset(haireye, Sex == 'Male'),
type = 'multiBarChart'
)
n1
http://surlyanalytics.shinyapps.io/github_hot_or_not/
http://shiny.rstudio.com/gallery/widgets-gallery.html
http://shiny.rstudio.com/reference/shiny/latest/
http://shiny.rstudio.com/reference/shiny/latest/
tabPanel("tableau", includeHTML("tableau_dashboard.html"), align = 'center')
output$plot_github <- renderChart2({
df <- chooseLang()
df2 <- crunchDataGithub(df)
df3 <- filterGithub()
color <- setColorGithub(df2,df3)
n <- createPlotGithub(df3, color)
})
output$repo_owner <- renderUI({
df <- chooseLang()
df2 <- crunchDataGithub(df)
owner_list <- sort(unique(df2$repository_owner))
selectizeInput(inputId = "owner",
label = h4("Owner:"),
choices = owner_list,
multiple = TRUE)
})
createPlotGithub <- function(df2, color) {
df3 <- select(df2, repository_watchers, age_days, watch_group, log_forks,
repository_name, watch_per_day, repository_owner,
repository_forks, date_created_str)
p <- nPlot(repository_watchers ~ age_days,
group = 'watch_group',
data = df3,
type = 'scatterChart')
p$yAxis(axisLabel = 'Stars')
p$xAxis(axisLabel = 'Age in Days')
p$chart(color = color)
p$chart(size = '#! function(d){return d.log_forks} !#')
return(p)
}
p$chart(tooltipContent = "#!
function(key, x, y, d){
return '<h3>' + d.point.repository_name + '</h3>' +
'<p> <b>' + d.point.watch_per_day + ' Stars/Day' + '</b> </p>' +
'<p> Owner = ' + d.point.repository_owner + '</p>' +
'<p> Age in Days = ' + d.point.age_days + '</p>' +
'<p> Stars = ' + d.point.repository_watchers + '</p>' +
'<p> Forks = ' + d.point.repository_forks + '</p>' +
'<p> Date Created = ' + d.point.date_created_str + '</p>'
}
!#")
createButtonLink <- function(link, text) {
sprintf('
<a class="mcnButton"
href="%s"
target="_blank"
style="font-weight: normal;
background-color: #337EC6;
...
color: #FFFFFF;
word-wrap: break-word !important;
font-family:Arial;"
>%s</button>
',link, text)
}
shinyUI(
navbarPage(
id = "nbp",
title = "Data Hub",
theme = "bootstrap.css",
...
Shiny http://shiny.rstudio.com/
Shiny tutorial https://github.com/wsurles/shiny_workshop
rCharts http://rcharts.io/
Slidify http://slidify.github.io/
Slidify example http://slidify.github.io/dcmeetup/#1