Skip to content

Instantly share code, notes, and snippets.

Maya Gans MayaGans

Block or report user

Report or block MayaGans

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MayaGans
MayaGans / App.R
Last active Feb 20, 2020
create radio and dropdown shiny input
View App.R
library(shiny)
library(shinyjs)
css <- ".btn-grey {
border: none;
outline: none;
padding: 10px 16px;
background-color: white;
cursor: pointer;
font-size: 18px;
@MayaGans
MayaGans / App.R
Last active Feb 20, 2020
Group Buttons AND dropdown menu
View App.R
library(shiny)
library(shinyjs)
source("group_and_radio.R")
css <- ".btn-grey {
border: none;
outline: none;
padding: 10px 16px;
background-color: white;
@MayaGans
MayaGans / App.R
Created Feb 19, 2020
Changing the Width of sidePanel
View App.R
library(shiny)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
# this is not what I want
sidebarPanel(style = "min-width: 750px",
sliderInput("bins",
"Number of bins:",
min = 1,
View sharla_diff
sharla_diff <- function(df, expected_df) {
data_as_expected <- dplyr::all_equal(expected_df, df)
if (!isTRUE(data_as_expected)) {
data_diffs <- janitor::compare_df_cols(expected_df, df)
cols_mismatch <- dplyr::filter(data_diffs, is.na(expected_df) | is.na(df))
extra_cols <- cols_mismatch %>%
dplyr::filter(is.na(expected_df)) %>%
@MayaGans
MayaGans / index.html
Created Feb 13, 2020
Zoom Map Based on Points
View index.html
<!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>
@MayaGans
MayaGans / App.R
Last active Feb 13, 2020
Change SVG Color using JavaScript in R
View App.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")
View App.R
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) {
View App.R
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
Created Feb 3, 2020
Use HTML <select> to change Shiny radioButton
View App.R
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
tagList(
tags$div(
HTML("
<select id='yes_no'>
<option value='yes'>Yes</option>
View App.R
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
tagList(
tags$div(
HTML("
<select id='yes_no'>
<option value='yes'>Yes</option>
You can’t perform that action at this time.