For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
#!/bin/bash | |
# These variables can be overwritten using the arguments below | |
VERSION="1.1.463" | |
# drwho is listed as user in YARN's Resource Manager UI. | |
USER="drwho" | |
# Depending on where the EMR cluster lives, you might have to change this to avoid security issues. | |
# To change the default password (and user), use the arguments bellow. | |
# If the cluster is not visible on the Internet, you can just leave the defaults for convenience. | |
PASS="tardis" |
#https://github.com/ateucher/useful_code/blob/master/R/numbers2words.r | |
numbers2words <- function(x){ | |
## Function by John Fox found here: | |
## http://tolstoy.newcastle.edu.au/R/help/05/04/2715.html | |
## Tweaks by AJH to add commas and "and" | |
helper <- function(x){ | |
digits <- rev(strsplit(as.character(x), "")[[1]]) | |
nDigits <- length(digits) | |
if (nDigits == 1) as.vector(ones[digits]) |
# install the new/experimental plotly R package | |
# devtools::install_github("ropensci/plotly@carson-dsl") | |
# ---------------------------------------------------------------------- | |
# https://plot.ly/r/3d-line-plots/ | |
# ---------------------------------------------------------------------- | |
library(plotly) | |
# initiate a 100 x 3 matrix filled with zeros |
library(shiny) | |
library(magrittr) | |
shinyServer(function(input, output, session) { | |
#__________________________________________________________________________________ | |
# The main named list that will be used in many other tasks. | |
listN <- reactiveValues() | |
makeReactiveBinding("listN") | |
# | |
# Example of dplyr's mutate and lag with magrittr's %>% | |
# to flexibly add lags to a data.frame | |
# | |
library(dplyr) | |
library(magrittr) # >= v.1.0.1 | |
# A function to generate a mutate call | |
lag_gen <- function(x, lags) | |
{ |
The map shows traffic accidents recorded in Oslo, Norway, for the year 2013.
The Leaflet Markercluster plugin is wonderful. Since the markerclusters are divIcons you can put whatever you want inside them using the iconCreateFunction. I wanted my clusters to reveal more information than just the marker count and figured a pie chart would do the job. So I told the iconCreateFunction to do some D3 magic and this is the result.
The example is a bit more complicated than necessary due to how my dataset is structured. But if you take a look at the defineClusterIcon() function you'll see that I use d3.nest() to build a dataset for the pie chart based on a given property from all the cluster's children. Then I pass this dataset over to the bakeThePie() function together with instructions on how to style the chart. The function returns svg markup which in turn is placed inside the divIcon.
Feel free to suggest improvements.
library(shiny) | |
library(dplyr) | |
library(lubridate) | |
# Load libraries and functions needed to create SQLite databases. | |
library(RSQLite) | |
library(RSQLite.extfuns) | |
saveSQLite <- function(data, name){ | |
path <- dplyr:::db_location(filename=paste0(name, ".sqlite")) |
library(shiny) | |
shinyServer(function(input, output, session) { | |
# The number of iterations to perform | |
maxIter <- 50 | |
# Track the start and elapsed time | |
startTime <- Sys.time() | |
output$elapsed <- renderText({ |