Skip to content

Instantly share code, notes, and snippets.


Dean Attali daattali

View GitHub Profile
View ListDynamicCountryByAsset.json.txt
[{"CountryList": ["Austria", "Germany", "Italy", "Spain", "United Kingdom"], "Sector3": "Commercial Leases"}, {"CountryList": ["Belgium", "France", "Germany", "Ireland", "Italy", "Netherlands", "Portugal", "Spain", "United Kingdom"], "Sector3": "Residential Mortgage"}, {"CountryList": ["Belgium", "France", "Ireland", "Spain", "United Kingdom"], "Sector3": "Credit Card"}, {"CountryList": ["Belgium", "Germany", "Italy", "Portugal", "Spain"], "Sector3": "SME CLO"}, {"CountryList": ["France", "Germany", "Netherlands"], "Sector3": "Auto Leases"}, {"CountryList": ["France", "Germany", "Italy", "Netherlands", "Norway", "Portugal", "Spain", "United Kingdom"], "Sector3": "Auto Loans"}, {"CountryList": ["France", "Germany", "Italy", "Netherlands", "Portugal", "Spain", "Sweden"], "Sector3": "Consumer Loans"}, {"CountryList": ["France", "Portugal", "United Kingdom"], "Sector3": "Mixed Auto Loans and Leases"}, {"CountryList": ["Germany", "Ireland", "Italy", "Spain"], "Sector3": "Consumer and Commercial Leases"}, {"Country
daattali / linkedin.R
Created Mar 5, 2016
Scraping Twitter and LinkedIn info in R
View linkedin.R
# Get a person's name, location, summary, # of connections, and skills & endorsements from LinkedIn
# URL of the LinkedIn page
user_url <- ""
# since the information isn't available without being logged in, the web
# scraper needs to log in. Provide your LinkedIn user/pw here (this isn't stored
# anywhere as you can see, it's just used to log in during the scrape session)
username <- "yourusername"
password <- "yourpassword"
daattali / layout_change.R
Created May 13, 2017
Change the width of the main panel depending on what tab is open
View layout_change.R
ui <- fluidPage(
# You have to include this one-liner CSS
tags$style(".fullwidth { width: 100% !important; }"),
# You need to wrap the sidebarLayout() by a div() and give it an ID
div(id = "SOMEID",
daattali / bcl-process.R
Created Nov 26, 2015
Process BC Liquor Store data
View bcl-process.R
rawDataUrl <- ""
bcl <- read.csv(rawDataUrl, stringsAsFactors = FALSE)
bcl <- dplyr::filter(bcl, PRODUCT_CLASS_NAME %in% products) %>%
daattali / app.R
Last active May 4, 2021
Basic form-submission shiny app used in "Persistent data storage in shiny apps" article
View app.R
# Define the fields we want to save from the form
fields <- c("name", "used_shiny", "r_num_years")
# Save a response
# ---- This is one of the two functions we will change for every storage type ----
saveData <- function(data) {
data <-
if (exists("responses")) {
View plotlycurvenumber.R
# I'm trying to let the user select points and paint them in a certain colour, and if the user clicks on a point then paint that point a different colour.
# It looks like the pointNumber and curveNumber data that plotly returns are different for the same points. I'm not sure how curveNumber works, but to me it doesn't make sense yet :)
# Any help is appreciated!
ui <- fluidPage(
daattali / server.R
Last active Jan 14, 2021 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
View server.R
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
daattali / quiet.R
Created Sep 25, 2015
Suppress all output from an expression, cross-platform
View quiet.R
#' Suppress all output from an expression. Works cross-platform.
#' @param expr Expression to run.
#' @param all If \code{TRUE} then suppress warnings and messages as well;
#' otherwise, only suppress printed output (such as from \code{print} or
#' \code{cat}).
#' @keywords internal
#' @export
quiet <- function(expr, all = TRUE) {
if (['sysname'] == "Windows") {
file <- "NUL"
daattali / bad.R
Created Mar 5, 2020
using reactivity correctly
View bad.R
makePlot <- function(xvar, yvar) {
ggplot(iris, aes_string(xvar, yvar)) + geom_point()
ui <- fluidPage(
selectInput("xvar", "X variable", choices = names(iris), selected = names(iris)[1]),
selectInput("yvar", "Y variable", choices = names(iris), selected = names(iris)[2]),
daattali / rselenium-taxonomer-1-upload.R
Last active Jun 24, 2019
Use RSelenium to automatically upload many FASTQ files, submit each to "full analysis" when it's ready, and download the analyzed file on
View rselenium-taxonomer-1-upload.R
# This script uploads all the FAST files to the taxonomer server (only one file can be uploaded at a time)
# Assumes that you have RSelenium package installed and that you've got a simple selenium example to work
if (FALSE) {
fastq_files <- c(
list.files(# WHERE ARE THE FILES?, pattern = "fastq.gz$", full.names = TRUE)
login_password <- "" # what is my password???