Skip to content

Instantly share code, notes, and snippets.

---
title: "Research pipeline"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: yeti
---
```{r include=FALSE}
library(tidyverse)
@sjkiss
sjkiss / stats_can_help.R
Created January 16, 2019 17:29
Error in Statistics Canada's Web Data Service
#install.packages('rjson')
library(rjson)
#This is the sample URL from your web data help page.
census_url<-'https://www12.statcan.gc.ca/rest/census-recensement/CPR2016.json?lang=E&dguid=2016A000011124&topic=1&notes=0'
#This returns an unexpected character
fromJSON(file=census_url)
#Load two libraries
library(xml2)
library(rvest)
#Paste the digit 1 thru 12 into the base URL to create 12 separate URLs, one each for a batch
urls<-lapply(seq(1,12, 1), function(x) paste('http://www.chemicalsubstanceschimiques.gc.ca/challenge-defi/batch-lot-',x,'/index-eng.php', sep=''))
#Check
urls
#read the html code from each batch home page
@sjkiss
sjkiss / package_install
Last active August 29, 2015 14:21
Install key packages for LSIRM
#Packages to be installed
to.install<-c('car', 'plotrix', 'psych')
#Determine Uninstalled Packages
new.packages <- to.install[!(to.install %in% installed.packages()[,"Package"])]
#If the number of uninstalled packages is non-zero, install uninstalled packages
if(length(new.packages)) install.packages(new.packages)