Skip to content

Instantly share code, notes, and snippets.

@MayaGans
MayaGans / app.R
Last active January 3, 2020 16:10 — forked from gadenbuie/app.R
drag and drop a new element
library(shiny)
library(tidyverse)
ui <- fluidPage(
tags$head(
tags$link(rel = "//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"),
tags$script(src = "https://code.jquery.com/ui/1.12.1/jquery-ui.js"),
tags$link(href = "styles.css", rel = "stylesheet")
),
fluidRow(
@MayaGans
MayaGans / app.R
Last active January 23, 2020 22:48
library(shiny)
# dummy list of dataframes
test <- data.frame("A" = NA, "B" = NA, "X" = NA)
test2 <- data.frame("D" = NA, "E" = NA, "F" = NA)
test3 <- data.frame("G" = NA, "H" = NA, "X" = NA)
combined_tests <- list(test = test, test2 = test2, test3 = test3)
# Turn list of dataframes into buckets of draggable blocks
rowBlock <- function(name) {
@MayaGans
MayaGans / app.R
Created January 24, 2020 15:06 — forked from gadenbuie/app.R
library(shiny)
# dummy list of dataframes
test <- data.frame("A" = NA, "B" = NA, "X" = NA)
test2 <- data.frame("D" = NA, "E" = NA, "F" = NA)
test3 <- data.frame("G" = NA, "H" = NA, "X" = NA)
combined_tests <- list(test = test, test2 = test2, test3 = test3)
# Turn list of dataframes into buckets of draggable blocks
rowBlock <- function(name) {
@MayaGans
MayaGans / app.R
Last active January 26, 2020 15:53
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
verbatimTextOutput(ns("debug"))
}
# MODULE SERVER
# Render the custom shiny input binding
@MayaGans
MayaGans / App.R
Last active February 1, 2020 07:05
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
tagList(
tags$div(
HTML("
<select id='yes_no'>
<option value='yes'>Yes</option>
@MayaGans
MayaGans / App.R
Created February 3, 2020 14:41
Use HTML <select> to change Shiny radioButton
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
tagList(
tags$div(
HTML("
<select id='yes_no'>
<option value='yes'>Yes</option>
library(shiny)
library(tippy)
# list of dataframes
datalist <- list(data.frame(A = c("col_1", "col_2", "col_3"), B = c("val_1", "val_2", "val_3")),
data.frame(X = c("col_4", "col_5", "col_6"), Y = c("val_4", "val_5", "val_6")),
data.frame(A = c("col_7", "col_8", "col_9"), B = c("val_7", "val_8", "val_9")))
@MayaGans
MayaGans / App.R
Last active February 11, 2020 21:37
library(shiny)
my_df <- data.frame(values = c("A", "B", "C"))
ui <- fluidPage(
div(id = "my_select"),
tags$script(src = "select.js")
)
server <- function(session, input, output) {
@MayaGans
MayaGans / App.R
Last active February 13, 2020 02:59
Change SVG Color using JavaScript in R
library(shiny)
ui <- fluidPage(
tags$head(tags$link(rel = "stylesheet",
type = "text/css", href = "styles.css")),
sidebarPanel(
div(class="human-body", id="human-body", uiOutput("svgout")),
div(style="height:200px;"),
verbatimTextOutput("debug")
@MayaGans
MayaGans / index.html
Created February 13, 2020 17:53
Zoom Map Based on Points
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Simple Bar chart</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.13/d3.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script src="https://d3js.org/d3-array.v1.min.js"></script>