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
co2 = read.table("ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_annmean_mlo.txt") | |
temp = read.table("https://climate.nasa.gov/system/internal_resources/details/original/647_Global_Temperature_Data_File.txt") | |
names(co2) = c("year", "co2", "unc") | |
names(temp) = c("year", "raw_temp", "smoothed_temp") | |
dta <- merge(co2,temp, by="year") | |
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
# inspired by | |
# http://blog.plover.com/2017/02/21/#anagram-scoring | |
download.file("http://pic.blog.plover.com/lang/anagram-scoring/Web2.txt.gz", destfile = "compressWords.txt.gz") | |
w <- tolower(readLines("compressWords.txt.gz")) | |
ord <- as.character(lapply(lapply(strsplit(w,NULL),sort),paste,collapse="")) | |
# what I haven't tested is if it is faster to find the pairs and test all or test and find the best pair | |
# the first is much simpler code and computers are fast enough. I am a data guy not a CS guy. | |
# avoid self matches by picking only one starter from each group there is an anagram for |
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(tidypvals) | |
library(dplyr) | |
library(fulltext) | |
library(tidytext) | |
library(tidyr) | |
library(ggplot) | |
library(parallel) | |
hasDOI <- allp %>% filter(!is.na(doi), operator == "equals") | |
plosDOI <- hasDOI[grep("pone", hasDOI$doi),] |
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(readxl) | |
library(lubridate) | |
library(dplyr) | |
houses <- read.csv("~/Downloads/raw_data/AU.csv", stringsAsFactors = FALSE) | |
houses$Date <- ymd(houses$Date) | |
hs <- houses %>% arrange(CODE, Date) %>% group_by(CODE) %>% | |
mutate(new_houses = Stock - lag(Stock)) %>% ungroup() %>% | |
mutate(new_value = new_houses * Median_SP) %>% group_by(Date) %>% | |
summarise(amount_spent = sum(new_value, na.rm=TRUE)) | |
# amount_spent is an esitmated value of the amount of new housing for |
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
# my graph for when people say Climate Change is due to natural processes | |
# modify CO2_label and natural_label to suit their individual arguement wording | |
co2_label <- "Trend caused by CO2 added by people (what climate change is about)" | |
natural_label <- "Variation caused by natural events (what you are talking about)" | |
co2 = read.table("ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_annmean_mlo.txt") | |
temp = read.table("https://climate.nasa.gov/system/internal_resources/details/original/647_Global_Temperature_Data_File.txt", | |
header=FALSE) |
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(tidyr) | |
library(ggplot2) | |
# from http://www.elections.org.nz/events/2017-general-election/2017-general-election-party-lists | |
listText <- "number person | |
NA ACT NEW ZEALAND | |
1 SEYMOUR, David | |
2 HOULBROOKE, Beth |
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
#2017 NZ electorate candidates | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(ggridges) | |
# from | |
listText <- "party firstname surname | |
National Kanwaljit Singh Bakshi | |
National Tim van de Molen |
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(lubridate) | |
library(dplyr) | |
library(ggplot2) | |
#some example data | |
set.seed(20180101) | |
example_data <- data.frame( | |
dt = sample(seq.Date(from=as.Date("2018-01-01"), to=as.Date("2018-12-31"), by="day"), size=400, replace=TRUE), | |
ampm = sample(c("AM","PM"), size=400, replace=TRUE), | |
tutor = sample(c("alpha","beta", "gamma"), size=400, replace=TRUE), |
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(OECD) | |
library(feather) | |
library(dplyr) | |
library(countrycode) | |
library(tidyr) | |
library(purrr) | |
library(broom) | |
library(ggplot2) | |
library(viridis) |
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(OECD) | |
library(feather) | |
library(dplyr) | |
library(tidyr) | |
library(purrr) | |
library(broom) | |
library(ggplot2) | |
library(viridis) | |
OlderNewer