This file contains hidden or 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
--- | |
title: "Loop to Auto Build Tabs Containing htmlwidgets" | |
output: flexdashboard::flex_dashboard | |
--- | |
```{r setup, echo =FALSE, eval = TRUE} | |
library(tidyverse) | |
library(flexdashboard) | |
library(highcharter) |
This file contains hidden or 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(highcharter) | |
library(tidyverse) | |
# set up the series data (so many list of lists...) | |
## dates are one of the toughest things to plot | |
## the key to understanding this is in the function `highcharter::hc_add_series_time_values` | |
## in it, you will find how highcharter parses dates, using `highcharter::datetime_to_timestamp` | |
## which accepts as.Date values, converts to as.POSIXct then to numeric * 1000 |
This file contains hidden or 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
<!-- Styles for R syntax highlighter --> | |
<style type="text/css"> | |
pre .operator, | |
pre .paren { | |
color: rgb(104, 118, 135) | |
} | |
pre .literal { | |
color: rgb(88, 72, 246) | |
} |
This file contains hidden or 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
# variables | |
OUTPUT_DIR = "~/Dropbox/Jails/data") | |
DATE <- format(Sys.time(), '%Y-%m-%d') | |
FILENAME <- sprintf("%s-wake-county-records.csv", DATE) | |
url <- 'http://p2c.wakeso.net/jqHandler.ashx?op=s' | |
# set up form request | |
# query found using Chrome developer tools. | |
# Ran Query > Go to "Network" tab > find "jqHandler.ashx?op=s" |
This file contains hidden or 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(httr) | |
library(tidyverse) | |
library(xml2) | |
library(rvest) | |
devtools::install_github('dantonnoriega/xmltools') | |
# SET UP VARIABLES | |
# record_type: | |
# "0" (all incarcerated) | |
# "1" (last 24 hours) |
This file contains hidden or 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
--- | |
title: TEST | |
output: | |
pdf_document: | |
latex_engine: xelatex | |
html_document: | |
fig_caption: true | |
--- | |
```{r, echo = FALSE} |
This file contains hidden or 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
# Creating html plots with highcharter and generating high resolution PNGs of plots with webshot | |
library(highcharter) | |
# set up directories | |
OUTPUT_HTML <- '~/Downloads/hc-webshot-example/html' | |
OUTPUT_PNG <- '~/Downloads/hc-webshot-example/png' | |
if(!dir.exists(OUTPUT_HTML)) dir.create(OUTPUT_HTML, recursive = TRUE) | |
if(!dir.exists(OUTPUT_PNG)) dir.create(OUTPUT_PNG, recursive = TRUE) |
This file contains hidden or 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
# script UTM | |
# functions | |
get_utm <- function(x) { | |
# empty frame | |
ef <- structure(list(cf_affiliate_id = character(1), utm_source = character(1), | |
utm_medium = character(1), utm_campaign = character(1), utm_term = character(1), | |
utm_content = character(1), webinar_delay = character(1), | |
purchase_product_ids = character(1), purchase_taxamo_transaction_key = character(1), |
This file contains hidden or 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
# $match example for zsh | |
# inspiration: | |
# https://stackoverflow.com/questions/13043344/search-and-replace-in-bash-using-regular-expressions | |
# reprex | |
mkdir CS106B | |
cd CS106B | |
# download mp4s of programmming abstraction |
This file contains hidden or 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
stname | st | stusps | |
---|---|---|---|
Alabama | 01 | AL | |
Alaska | 02 | AK | |
Arizona | 04 | AZ | |
Arkansas | 05 | AR | |
California | 06 | CA | |
Colorado | 08 | CO | |
Connecticut | 09 | CT | |
Delaware | 10 | DE | |
District of Columbia | 11 | DC |