As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.
The problems and solutions described in the examples below have led to the development of sciluigi,
library(shiny) | |
library(shinyjs) | |
if (!dir.exists('www/')) { | |
dir.create('www') | |
} | |
download.file( | |
url = 'https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js', | |
destfile = 'www/js.cookie.js' |
As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.
The problems and solutions described in the examples below have led to the development of sciluigi,
p_load(formattable) | |
DF <- data.frame(Ticker=c("", "", "", "IBM", "AAPL", "MSFT"), | |
Name=c("Dow Jones", "S&P 500", "Technology", | |
"IBM", "Apple", "Microsoft"), | |
Value=accounting(c(15988.08, 1880.33, NA, | |
130.00, 97.05, 50.99)), | |
Change=percent(c(-0.0239, -0.0216, 0.021, | |
-0.0219, -0.0248, -0.0399))) | |
DF | |
## Ticker Name Value Change |
dat <- data.frame( | |
freq = c(37, 88, 47, 89, 28, 68, 65, 98, 68, 86, 50, 87, 59, 82, 45, 65, 52, 32, 59, 47, 68, 78, 39, 31, 64, 68) | |
) | |
dat[["sector"]] <- rep(c("U.S. adults", "AAAS scientist"), nrow(dat)/2) | |
field <- c("Biomedical sciences", "Climate, energy, space sciences") | |
dat[["field"]] <- factor(rep(field, c(10, 16)), levels=field) | |
items <- c( |
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */ | |
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/ | |
async function fetchURLs() { | |
try { | |
// Promise.all() lets us coalesce multiple promises into a single super-promise | |
var data = await Promise.all([ | |
/* Alternatively store each in an array */ | |
// var [x, y, z] = await Promise.all([ | |
// parse results as json; fetch data response has several reader methods available: | |
//.arrayBuffer() |
if (!require("pacman")) install.packages("pacman"); library(pacman) | |
p_load(tidyverse, cowplot) | |
cols <- c(lightblue = '#62B1F6', darkblue = '#27408B') | |
dat <- data_frame( | |
type = state.name[1:18], | |
Total = c(522, 464, 332, 185, 90, 811, 121, 242, 258, 175, 346, 217, 186, 133, 144, 136, 53, 306), | |
Sub = c(6, 6, 13, 19, 21, 11, 7, 8, 16, 29, 78, 71, 90, 68, 90, 99, 35, 14) | |
) |
FROM php:7.1.2-apache | |
RUN docker-php-ext-install mysqli |
# For more info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html | |
import cv2 | |
import numpy as np | |
import os | |
FILE_OUTPUT = 'output.avi' | |
# Checks and deletes the output file | |
# You cant have a existing file or it will through an error | |
if os.path.isfile(FILE_OUTPUT): |
p_load(ggplot2, fivethirtyeight, dplyr, gridExtra) | |
data("police_deaths") | |
police_deaths_count <- police_deaths %>% arrange(state, -year) %>% group_by(state, year) %>% count() | |
police_deaths_count <- police_deaths_count %>% arrange(state, -year) %>% | |
filter(year %in% c(1970:2015) & !state %in% c("AK", "HI", "US", "GU", "MP", "PR", "RR", "TR", "VI")) | |
# Create unique blank strip labels for empty facets | |
bl = sapply(1:37, function(n) paste(rep(" ",n),collapse="")) |