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
The Simon–Ehrlich wager was a 1980 scientific wager between business professor Julian L. Simon and biologist Paul Ehrlich, betting on a mutually agreed-upon measure of resource scarcity over the decade leading up to 1990 | |
https://en.wikipedia.org/wiki/Simon%E2%80%93Ehrlich_wager | |
Roughly it was a bet where Simon thought things would get better as people invented and organised. Eldrich thought we would run out of stuff and overpopulation would result in starvation of hundreds of millions. | |
Simon won the bet as these metals were cheaper ten years later. But I wondered how ofter Simon would be rigth if the bet happened at different times. | |
Ten years later metals would be cheaper 55% of the time in this dataset. | |
Data from https://www.usgs.gov/centers/nmic/historical-statistics-mineral-and-material-commodities-united-states |
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(tidyverse) | |
library(lubridate) | |
library(RCurl) | |
library(reshape2) | |
#URL <- "https://www.metoffice.gov.uk/hadobs/hadcet/cetmaxdly1878on_urbadj4.dat" | |
cet2 <- read.table("cetmaxdly1878on_urbadj4.dat.txt", sep = "", header = FALSE, | |
fill = TRUE)#),na.string = c(-99.99, -99.9, -999)) | |
colnames(cet2) <- c("year","day","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") |
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
breaks <- read.csv("breaks.csv", stringsAsFactors=FALSE) | |
breaks<-select (breaks,-c(X,X.1,X.2)) | |
breaks<-na.omit(breaks) | |
names(breaks)[names(breaks) == "X."] <- "Centuries" | |
library(ggplot2) | |
# Basic scatter plot | |
g<-ggplot(breaks, aes(x=Year, y=Centuries)) + | |
geom_point(shape=1) + # Use hollow circles | |
geom_smooth(method=lm) + |
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
historic<-read.csv("historic.csv", skip=10) | |
library(dplyr) | |
# Drop the columns of the dataframe | |
historic<-select (historic,-c(X.1,X.2,X.3,X.4,X.5,X.6,X.7,X.8,X.9,X.10,X.11)) | |
historic <- rename(historic, number = Level..numbers.of.unemployed.people.) #For renaming dataframe column | |
historic <- rename(historic, rate = Rate....) #For renaming dataframe column | |
#start is nas | |
historic2<-slice(historic, 499:n()) |
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
Cand <- c('Donnelly\n SF','Varadkar\n FG','Chambers\n FF','Coppinger\n SOL-PBP','O’Gorman\n Grn','Burton\n Lab') | |
per <- c(29, 18, 16,11,9,5) | |
part<-c("#CC0000","#660000","#66BB66","#326760","#99CC33","#009FF3") | |
df <- data.frame(Cand, per,part) | |
library(ggplot2) | |
# Basic barplot | |
p<-ggplot(data=df, aes(x=Cand, y=per, fill =part)) + | |
geom_bar(stat="identity", show.legend = FALSE)+scale_fill_manual(values=c("#CC0000","#660000","#66BB66","#326760","#99CC33","#009FF3"))+theme_minimal()+theme(plot.title = element_text(hjust = 0.5)) |
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
require(data.table) | |
require(tidyverse) | |
require(ggparliament) | |
irl<-read.csv("ireland.csv",header=1) | |
#colour column needs to be chr not factor | |
irl<-irl %>% mutate_if(is.factor, as.character) | |
irl_horseshoe <- parliament_data(election_data = irl, | |
party_seats = irl$seats, |
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
Country | Continent | random | randomC | |
---|---|---|---|---|
Algeria | AFRICA | 60.6167300016224 | 61 | |
Angola | AFRICA | 71.5212095913241 | 72 | |
Benin | AFRICA | 51.7624535957612 | 52 | |
Botswana | AFRICA | 15.7730987774009 | 16 | |
Burkina | AFRICA | 43.4650351116097 | 44 | |
Burundi | AFRICA | 65.5623808542023 | 66 | |
Cameroon | AFRICA | 50.6499306806902 | 51 | |
Cape Verde | AFRICA | 13.4829147803843 | 14 | |
Central African Republic | AFRICA | 17.8374229865049 | 18 |
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(ggplot2) | |
library(tidyr) | |
library(viridis) | |
library(scales) | |
library(ggthemes) | |
aus<-read.csv("latest.txt",sep=",",header=FALSE) | |
names(aus)[1] <- "time" |
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: "Loudness by Genre" | |
output: html_notebook | |
--- | |
An analysis of music by Genre to see if loudness varies | |
It was believed that online streaming platform have reduced loudness. But does this have the same effect accross all genres of music? | |
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
data from https://www.federalreserve.gov/releases/z1/dataviz/dfa/distribute/table/#range:1989.3,2019.2;quarter:119;series:Net%20worth;demographic:networth;population:all;units:shares | |
```{r} | |
wealth<-read_csv("dfa-networth-shares.csv") | |
head(wealth) | |
``` | |
```{r} |