- Production network example.
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
/* | |
run `cargo new your-project-name` in terminal | |
this is src/main.rs | |
input.txt is in the root dir of your-project-name | |
*/ | |
use std::fs; | |
fn main() { |
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
# Get 2016 Census data on major field of study by sex | |
library(tidyverse) | |
library(janitor) | |
census_url <- "https://www12.statcan.gc.ca/census-recensement/2016/dp-pd/dt-td/CompDataDownload.cfm?LANG=E&PID=110456&OFT=CSV" | |
# wherever works for you; this is good for MacOS | |
destination_file <- "~/Downloads/census_education.zip" |
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
# Download the World Trade Database from http://cid.econ.ucdavis.edu/ucdstats.html | |
# From documentation: value is in thousands of current USD. | |
library(reshape2) | |
library(dplyr) | |
library(readr) | |
process_file <- function(f_name) { | |
# returns unzipped file. | |
# create tempfile to remove later. | |
tf <- tempfile(pattern="wtdb",fileext="zip") |
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
# base. not even sure why or how this works. | |
temp=as.data.frame(as.matrix(unlist(by(asm$g,asm[,"year"], | |
FUN=quantile, prob=.025)))) | |
colnames(temp)[1]="q2.5" # wut. | |
temp$year=rownames(temp) # wut. | |
asm=merge(asm,temp,by="year") # and slooow. | |
# dplyr. ez. | |
low = asm %>% | |
group_by(year) %>% |
(Please click this link to open in new window.) Testing Bostock's leaflet.js tutorial, adding relevant Canadian stuff for the project.
Map with bundled trade flows.
Choropleth Map
NewerOlder