Skip to content

Instantly share code, notes, and snippets.

Avatar
🐰

Cecilia Lee cecilialee

🐰
View GitHub Profile
@cecilialee
cecilialee / highlight_input.r
Created May 8, 2018
Highlighted text input in Shiny #r #shiny
View highlight_input.r
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 / pdf_mongolite.r
Last active Jun 21, 2019
Read and write pdf to MongoDB with mongolite in R #r #mongolite
View pdf_mongolite.r
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 / iframe_app.r
Last active Apr 17, 2020
Embed iFrame in Shiny #r #shiny
View iframe_app.r
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 / macbook_screenshot_location.sh
Created Apr 10, 2018
Change macbook screenshot save location.
View macbook_screenshot_location.sh
defaults write com.apple.screencapture location /path/
@cecilialee
cecilialee / filter_all_text.R
Last active Mar 31, 2018
Filter text in any columns in R. #r
View filter_all_text.R
library(dplyr)
search <- "color"
iris %>%
filter_all(any_vars(grepl(search, ., ignore.case = TRUE)))
@cecilialee
cecilialee / dt_horizontal_scroll.R
Created Mar 26, 2018
Set horizontal sroll in DT::datatable in Shiny. #r #shiny
View dt_horizontal_scroll.R
library(shiny)
library(DT)
ui <- fluidPage(
dataTableOutput("mtcars")
)
server <- function(input, output, session) {
output$mtcars <- renderDataTable(
datatable(mtcars, options = list(scrollX = TRUE))
@cecilialee
cecilialee / colored_icons_shiny.R
Last active Mar 23, 2018
Use colors on icons in Shiny. #r #shiny
View colored_icons_shiny.R
library(shiny)
library(DT)
library(dplyr)
ui <- basicPage(
tags$style(".glyphicon-ok-sign {color:#2b8ee5}
.glyphicon-question-sign {color:#f4e107}
.glyphicon-exclamation-sign {color:#e5413b}
.glyphicon-flag, .glyphicon-trash {color:#28b728}"),
DT::dataTableOutput("table")
@cecilialee
cecilialee / icon_in_dt.R
Last active Jul 31, 2020
Use icons in DT datatable in Shiny. #r #shiny #dt
View icon_in_dt.R
library(shiny)
library(DT)
library(dplyr)
ui <- basicPage(
DT::dataTableOutput("table")
)
server <- function(input, output, session) {
output$table <- DT::renderDataTable({
@cecilialee
cecilialee / condition_actions_app.R
Created Mar 19, 2018
Conditional actions in Shiny. #r #shiny
View condition_actions_app.R
library(shiny)
library(shinyjs)
source("module.R")
# UI ==========================================================================
ui <- fluidPage(
useShinyjs(),
radioButtons("mode", "Mode",
choices = c("Entry" = "entry",
"Validation" = "validation"),
@cecilialee
cecilialee / parse_quoted_na.R
Created Mar 14, 2018
Parse quoted "NA" to NA in R. #r
View parse_quoted_na.R
df <- replace(df, df == "NA", NA)
You can’t perform that action at this time.