-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcountry_connections.Rmd
46 lines (29 loc) · 1.06 KB
/
country_connections.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "network countries"
author: "Stephanie Rivera"
date: "5/14/2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
```
## R Markdown
```{r cars}
counts_country <- read.csv(file ="countries_pairs_counts.csv",header= TRUE, sep=",",stringsAsFactors = FALSE)
#filter for unique pairs
counts_country$country2 <- trimws(counts_country$country2)
new <- counts_country[which(counts_country$country1!=counts_country$country2),]
new$combo <- paste(new$country1,new$country2)
new <- new %>% filter(count >10)
new <- new[-c(26,21),]
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
a <- ggplot(new, aes(x = reorder(combo, count), y = count, fill=count)) + geom_bar(stat= "identity")+ theme(axis.text.x = element_text(angle = 90, hjust = 1)) + scale_fill_gradient(low = "red", high = "green") + ggtitle("Country counts for article contributors") + xlab(label = "Countries (count > 10)") + ylab(label = "Count") + coord_flip()
a
```
```{r}
ggsave("chord_diagram.png", a)
```