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
library(dplyr) | |
library(Rcrawler) | |
library(purrr) | |
library(httr) | |
x <- c( | |
"https://rostrum.blog", | |
"https://therostrumblog.wordpress.com/" | |
) |
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
knitr::include_url("https://matt-dray.github.io/earl18-presentation/") |
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
# Connecting R to SQL (with DBI and odbc) | |
# Original: 18 July 2018 | |
# Matt Dray | |
# Goal: join two datasets from different databases | |
# Basic approach: | |
# 1. Connect to database A, perform query, disconnect | |
# 2. As above for database B | |
# 3. Join the two dataframes returned from steps 1 and 2 |
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
# This code sources the CSV for GIAS from online | |
# The URL is in the form [standard path][creation date][.csv], so we can just | |
# change the creation date to today's date using Sys.Date() | |
gias <- data.table::fread( | |
paste0( | |
"http://ea-edubase-api-prod.azurewebsites.net/edubase/edubasealldata", | |
stringr::str_replace_all(Sys.Date(), "-", ""), | |
".csv" | |
) |
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
# Function to automate generation of RDS, simple CSV and plot using rtweet | |
# Matt Dray | |
# March 2018 | |
# Purpose: create an RDS, simplified CSV and plot of tweets containing search term | |
# from rtweet::get_tweets function and save to to folder with unique descriptive | |
# name related to search term. Assumes you have an 'output' folder in your home | |
# directory to store these files. Assumes you've already sorted out a twitter | |
# token as per http://rtweet.info/articles/auth.html |
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
--- | |
title: "Title" | |
subtitle: "Subtitle" | |
author: "Name" | |
date: "`r format(Sys.time(), '%d %B, %Y')`" | |
output: | |
html_document: | |
theme: cerulean | |
highlight: tango | |
number_sections: yes |
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
# Basic googlesheets functions | |
# Jan 2018 | |
# https://github.com/jennybc/googlesheets | |
# Browser sign-in required on first function execution | |
# 1. Load package ---- | |
#install.packages(googlesheets) | |
library(googlesheets) |
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
# Testing sparklyr for Coffee & Coding | |
# Matt Dray | |
# 29 Nov 2017 | |
# Following https://spark.rstudio.com/ | |
# R 3.4.2 & RStudio 1.1.383 | |
# What? ------------------------------------------------------------------- |
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
# Coffee & Coding: connecting R to SQL (with DBI and odbc) | |
# DfE-scpecific example | |
# 18 July 2018 | |
# Session: Cathy | |
# This script: Matt | |
# Basic approach: | |
# 1. Connect to database A, perform query, disconnect | |
# 2. As above for database B | |
# 3. Join the two dataframes returned from steps 1 and 2 |
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
# FIREBREAK Q2 2018 | |
# Government Art Collection | |
# Matt Dray | |
# 2 October 2018 | |
# Purpose: Wrangle XML files output from GAC database to CSV | |
# Call packages ----------------------------------------------------------- |