Skip to content

Instantly share code, notes, and snippets.

View alexsingleton's full-sized avatar

Alex Singleton alexsingleton

View GitHub Profile
#Set Working Directory and Options
setwd("~/Dropbox/Blocks")
options(scipen=999)
#Load Packages
packages <- c("R.utils","data.table","RCurl","bit64","maptools","rgdal","rgeos")
for (package in packages){
if(paste(package) %in% rownames(installed.packages()) == FALSE) {install.packages(paste(package))}
library(paste(package),character.only=TRUE)
}
file_invited <- as.data.frame(ReadBib("invited.bib"))
file_invited$title <- gsub("\\{|\\}","",file_invited$title)# Remove {}
file_invited$address <- gsub("\\{|\\}","",file_invited$address)# Remove {}
dates <- unlist(unique(file_invited$year))[order(unlist(unique(file_invited$year)),decreasing = TRUE)]
#Prints references - slightly different format as converted to data frame for formating
for (date in dates) {
cat(paste0("##",date),"\n")
file_journals <- ReadBib("journals.bib")
dates <- unlist(unique(file_journals$year))[order(unlist(unique(file_journals$year)),decreasing = TRUE)]
#Prints recerences
for (date in dates) {
cat(paste0("##",date),"\n")
print(file_journals[list(year=date)],.opts = list(style="markdown",bib.style ="authoryear" ,max.names =10,dashed=FALSE))
cat("\n")
}
#Inserts a download link to the PDF CV
conn<-file("./_site/cv.html")
text <- readLines(conn)
close(conn)
d_link <- "<li><i class='fa fa-download' aria-hidden='true'></i><a href='cv_Alex_Singleton.pdf'> Download CV (pdf)</a></li>"
text_new <- c(text[1:290],d_link,text[291:length(text)])
write(text_new, file = "./_site/cv.html")
render("cv.Rmd", "pdf_document",output_file="./_site/cv_Alex_Singleton.pdf")
@alexsingleton
alexsingleton / _site.yml
Last active January 31, 2017 20:11
website yaml
name: "Alex_Singleton"
navbar:
title: "Alex Singleton"
left:
- text: "Publications"
icon: fa-book fa-2x
href: publications.html
- text: "CV"
icon: fa-file fa-2x
href: cv.html
@alexsingleton
alexsingleton / .r
Created August 17, 2016 06:15
ESRI Function R
tool_exec &lt;- function(in_params, out_params) {
# the first input parameter, as a character vector
input.dataset &lt;- in_params[[1]]
# alternatively, can access by the parameter name:
input.dataset &lt;- in_params$input_dataset
print(input.dataset)
# ... do analysis steps
out_params[[1]] &lt;- results.dataset
#Install the arcgisbinding package
install.packages("https://4326.us/R/bin/windows/contrib/3.2/arcgisbinding_1.0.0.111.zip", repos=NULL, method="libcurl")
#Install older versions of the TwitteR and httr packages
install.packages("https://cran.r-project.org/src/contrib/Archive/twitteR/twitteR_1.1.8.tar.gz", repos=NULL, method="libcurl")
install.packages("https://cran.r-project.org/src/contrib/Archive/httr/httr_0.6.0.tar.gz", repos=NULL, method="libcurl")
#Load the arcgisbinding package and check license
library(arcgisbinding)
arc.check_product()