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
# List of packages for session | |
package_list = c('devtools', | |
'here', | |
'tidyverse', | |
'janitor', | |
'magrittr', | |
'parsedate') | |
# Install CRAN packages (if not already installed) |
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
node -v > .nvmrc |
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 loop generates a dataframe and plot for each offence | |
for(offence in cc_code_offences.l){ | |
offence_slug <- slugify::slugify(offence, alphanum_replace = "", space_replace = "_", tolower = TRUE) | |
offence_slug <- gsub("__", "_", offence_slug, fixed=TRUE) | |
df_name <- paste(offence_slug, ".df", sep = "") | |
plot_name <- paste("p_", offence_slug, sep = "") | |
tmp.df <- filter_cc_offence(df=ywg_monthly_crime_data_2008_2019, |
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
license: gpl-3.0 | |
height: 1100 | |
border: no |
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
# OSX Finder junk | |
.DS_Store | |
# environment variables incl. credentials | |
.env | |
# python virtual environments | |
.venv | |
venv |
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
eth302_takeoff$time <- as.POSIXct(eth302_takeoff$time, format = "%Y-%m-%d %H:%M:%S", tz="GMT") | |
eth302_takeoff$time_EAT = with_tz(eth302_takeoff$time, tzone = "Africa/Addis_Ababa") |
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
# History files | |
.Rhistory | |
.Rapp.history | |
# Session Data files | |
.RData | |
# Example code in package build process | |
*-Ex.R |
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 sunrise, sunset and dusk times for a location | |
################################################## | |
days <- seq(from = as.POSIXct("2017-01-01"), to = as.POSIXct("2017-12-31"), by = "days") | |
# coordinates for Toronto | |
lat <- 43.6532 | |
lon <- -79.3832 | |
coord <- matrix(c(lon, lat), nrow = 1) |
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
import requests | |
from bs4 import BeautifulSoup | |
import csv | |
from datetime import datetime | |
file_out = 'sunrise_sunset_toronto.csv' | |
base_url = 'https://www.timeanddate.com/sun/canada/toronto?month=5&year=2018' | |
base_city = 'toronto' | |
base_year = '2017' | |
root_el_id = 'as-monthsun' |
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
# Load required packages | |
load_requirements <- function(pkg){ | |
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] | |
if (length(new.pkg)) | |
install.packages(new.pkg, dependencies = TRUE) | |
sapply(pkg, require, character.only = TRUE) | |
} |
NewerOlder