This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load packages | |
library(shiny) | |
library(ggplot2) | |
library(tidyverse) | |
library(DT) | |
# Load data | |
load(url("http://s3.amazonaws.com/assets.datacamp.com/production/course_4850/datasets/movies.Rdata")) | |
# Define UI for application that plots features of movies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(ggplot2) | |
library(dplyr) | |
library(DT) | |
load(url("http://s3.amazonaws.com/assets.datacamp.com/production/course_4850/datasets/movies.Rdata")) | |
all_studios <- sort(unique(movies$studio)) | |
# UI | |
ui <- fluidPage( | |
sidebarLayout( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(dcr) | |
ui = fluidPage( | |
chartOutput("plot"), | |
fluidRow(column(6, dc_ui("chart1", text = "cyl", | |
show_filter = TRUE, | |
reset_text = TRUE)), | |
column(6, dc_ui("chart2", text = "gear by carb", | |
show_filter = TRUE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dcr) | |
dcr <- dcr(mtcars) | |
chart <- dcrchart(type = "rowChart", id = "chart1", dimension = "cyl", | |
reduce = reduceCount(), width = 400, height = 250, | |
colors = dc_code("d3.scale.category10()")) | |
dcr + chart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(DBI) | |
library(RPostgreSQL) | |
ui = basicPage( | |
) | |
server = function(input, output, session) { | |
con <- dbConnect(PostgreSQL(), | |
dbname = "myDB", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create y in linear scale | |
var y = d3.scaleLinear().domain([15, 90]).range([250, 0]); | |
// create x in log scale | |
var x = d3.scaleLog().domain([250, 100000]).range([0, 600]); | |
// create r in radius scale | |
var r = d3.scaleSqrt().domain([52070, 1380000000]).range([10, 50]); | |
// append circle and attr to svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
for (file in list.files("modules", full.names = TRUE)) source(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select * | |
from my_status | |
where date(enter_time) = date(now()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UI ========================================================================== | |
returnUI = function(id) { | |
ns <- NS(id) | |
tagList( | |
textInput(ns("txt"), "Write something") | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inputModuleUI <- function(id){ | |
ns <- NS(id) | |
wellPanel(textInput(ns('text1'), "First text"), | |
textInput(ns('text2'), "Second text")) | |
} | |
inputModule <- function(input, output, session){ | |
vals <- reactiveValues() | |
observe({vals$text1 <- input$text1}) | |
observe({vals$text2 <- input$text2}) |