Skip to content

Instantly share code, notes, and snippets.

View cecilialee's full-sized avatar

Cecilia Lee cecilialee

View GitHub Profile
@cecilialee
cecilialee / modal_dialog_input_1.R
Last active November 4, 2022 01:47
Modal dialog prompt for inputs in Shiny. #r #shiny
library(shiny)
shinyApp(
ui = basicPage(
actionButton("show", "Show modal dialog"),
verbatimTextOutput("print")
),
server = function(input, output) {
@cecilialee
cecilialee / iframe_app.r
Last active September 1, 2022 18:48
Embed iFrame in Shiny #r #shiny
library(shiny)
members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2'))
ui <- fluidPage(titlePanel("Getting Iframe"),
sidebarLayout(
sidebarPanel(
fluidRow(
column(6, selectInput("Member", label=h5("Choose a option"),choices=c('BCRA1','FITM2'))
))),
mainPanel(fluidRow(
@cecilialee
cecilialee / icon_in_dt.R
Last active February 22, 2022 19:11
Use icons in DT datatable in Shiny. #r #shiny #dt
library(shiny)
library(DT)
library(dplyr)
ui <- basicPage(
DT::dataTableOutput("table")
)
server <- function(input, output, session) {
output$table <- DT::renderDataTable({
@cecilialee
cecilialee / nested_list_to_df.R
Last active June 4, 2020 10:31
Convert nested list to dataframe in R with plyr. #r
library(plyr)
nested_list <- list(
a = list(
x = 1,
y = 2
),
b = list(
x = 3,
y = 4
@cecilialee
cecilialee / confirm_modal.R
Last active June 21, 2019 13:30
Create a pop-up modal dialog prompting for user's confirmation. (Confirm / Cancel) #r #shiny
library(shiny)
shinyApp(
# ui ------------------------------------------------------------------------
ui = basicPage(
actionButton("skip", "Skip"),
textOutput("status")
),
@cecilialee
cecilialee / pdf_mongolite.r
Last active June 21, 2019 13:24
Read and write pdf to MongoDB with mongolite in R #r #mongolite
library(dplyr)
library(mongolite)
# MongoDB connection
m <- mongo("listcopro")
# Read raw data
file <- file("/Users/cecilialee/Dropbox/dropbox/freelance/listcopro/bitbucket/recruitment/test/data/resume_1.pdf", "rb")
data <- readBin(file, "raw", 9999999)
@cecilialee
cecilialee / highlight_input.r
Created May 8, 2018 08:41
Highlighted text input in Shiny #r #shiny
library(shiny)
ui <- fluidPage(
h2("Highlight Input Example"),
# sample text for selection
p("The insured received an examination of the large intestine in 2014.
As a result, everything was normal and there was no need to go back
to the follow-up consultation and any examination and treatment."),
@cecilialee
cecilialee / macbook_screenshot_location.sh
Created April 10, 2018 07:30
Change macbook screenshot save location.
defaults write com.apple.screencapture location /path/
@cecilialee
cecilialee / filter_all_text.R
Last active March 31, 2018 04:44
Filter text in any columns in R. #r
library(dplyr)
search <- "color"
iris %>%
filter_all(any_vars(grepl(search, ., ignore.case = TRUE)))
@cecilialee
cecilialee / dt_horizontal_scroll.R
Created March 26, 2018 23:04
Set horizontal sroll in DT::datatable in Shiny. #r #shiny
library(shiny)
library(DT)
ui <- fluidPage(
dataTableOutput("mtcars")
)
server <- function(input, output, session) {
output$mtcars <- renderDataTable(
datatable(mtcars, options = list(scrollX = TRUE))