This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
# remotes::install_github("yonicd/snapper") | |
# remotes::install_github("thomas85p/shinyFiles") | |
library(snapper) | |
library(base64enc) | |
library(png) | |
library(shinyFiles) | |
js <- ' | |
function get_img_src() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Config that is very close to a i3 window manager's keybinding. | |
set -s escape-time 0 | |
setw -g aggressive-resize on | |
# First remove *all* keybindings | |
unbind-key -a | |
# List keys | |
bind-key ? list-keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(DT) | |
dat <- mtcars | |
shinyServer(function(input, output, session) { | |
output$ui_view_vars <- renderUI({ | |
vars <- colnames(dat) | |
## using selectizeInput with drag_drop and DT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shinyServer(function(input, output, session) { | |
# On startup, read the URL parameter | |
queryParams <- parseQueryString(isolate(session$clientData$url_search)) | |
if ('tab' %in% names(queryParams)) | |
updateTabsetPanel(session, 'tabset', selected = paste0('tab', queryParams[['tab']])) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: html_document | |
runtime: shiny | |
--- | |
``` {r, echo=FALSE} | |
library(knitr) | |
suppressMessages(library(dplyr)) | |
rady_class <- c("heroins") | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(readr) | |
library(DBI) | |
library(RSQLite) | |
read.csv2sqlite <- function(csv_file, sqlite_file, table_name, batch_size = 10000) { | |
## establish a connection to the database | |
condb <- dbConnect(SQLite(), sqlite_file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr); library(httr); library(rvest) | |
addr <- "Big Ben" | |
GET("http://maps.google.com/maps/api/geocode/xml", | |
query = list(address = addr)) %>% | |
content() %>% | |
html_nodes(xpath = "//location//lat | //location//lng") %>% | |
html_text() %>% | |
setNames(c("lng", "lat")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- data.frame(x = rep(1:3,2), | |
y = c(3,1,NA,3,NA,6)) | |
dat_org <- dat | |
ind <- complete.cases(dat) | |
model <- lm(y ~ x, data = dat[ind,]) | |
dat$res <- NA | |
dat[ind,"res"] <- model$res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(DBI) | |
library(RSQLite) | |
library(readr) | |
library(dplyr) | |
#========================================================================= | |
# Read a CSV file in chunks and stuff into a database. | |
# | |
# Note: This is proof-of-concept code only. | |
# It should work OK, but there are no guarantees. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(magrittr) | |
shinyServer(function(input, output, session) { | |
#__________________________________________________________________________________ | |
# The main named list that will be used in many other tasks. | |
listN <- reactiveValues() | |
#__________________________________________________________________________________ |
NewerOlder