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} |
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 the libraries | |
library(ggplot2) | |
library(grid) | |
library(dplyr) | |
#load the data | |
#https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/export/ | |
zips <- | |
read.csv("us-zip-code-latitude-and-longitude.csv", | |
header = TRUE, stringsAsFactors = TRUE,sep=";") |
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
```{r} | |
library(dplyr) | |
library(readr) | |
library(ggplot2) # devtools::install_github("hadley/ggplot2") | |
#library(hrbrmisc) # devtools::install_github("hrbrmstr/hrbrmisc") | |
library(grid) | |
library(scales) | |
library(grid) |
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
Now start with maps and locations | |
See if i can get the center of constituencies | |
data from https://geoportal.statistics.gov.uk/datasets/westminster-parliamentary-constituencies-december-2017-super-generalised-clipped-boundaries-in-the-uk/data | |
```{r} | |
locat<-read_csv("Westminster_Parliamentary_Constituencies_December_2017_Super_Generalised_Clipped_Boundaries_in_the_UK.csv")#, sheet = 2, skip=6 , header=TRUE | |
head(locat) |
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: "uk election" | |
output: html_notebook | |
--- | |
Inspired by this great graph by Alasdair Rae | |
https://twitter.com/undertheraedar/status/1190192038274310144 i want to make an election visualisation | |
data from https://commonslibrary.parliament.uk/parliament-and-elections/elections-elections/constituency-data-election-results/ | |
```{r} |