-
Notifications
You must be signed in to change notification settings - Fork 0
/
global.R
executable file
·55 lines (42 loc) · 1.9 KB
/
global.R
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
46
47
48
49
50
51
52
53
54
55
##load libraries
library(shiny)
library(leaflet)
library(RColorBrewer)
library(rgdal)
library(raster)
library(ggmap)
library(ggplot2)
library(RColorBrewer)
library(stringr)
Sys.setlocale('LC_ALL', locale = "English_United States.1252")
source("./newFilter.R")
#############################
countries <- readOGR('./world-shapefile', layer = 'world3')
articles <- read.csv('./data/Data Scraping for Journal Articles Final 041916.csv',fileEncoding = "UTF-8")
articles$keywords <- paste(articles$Second.Keyword,articles$X,articles$X.1,articles$X.2,articles$X.3,articles$X.4,articles$X.5,articles$X.6,sep=",")
print(articles)
#participatory <- read.csv('./data/ParticipatoryData.csv')
#removing South Sudan from my dataset
#participatory <- subset(participatory, COUNTRY!="South Sudan")
countries@data$polyorder <- 1 : dim(countries@data)[1]
#tmp <- merge(countries@data, participatory, by = "ISO3", sort = TRUE, all.x = TRUE)
#tmp <- tmp[ order(tmp$polyorder), ]
#countries@data <- tmp
#make map with color scale based on 'WORK'
#countryColor <- colorFactor(topo.colors(10), countries@data$WORK)
#Generating unique list of countries
WorldCountryList <- unique(countries@data$NAME) %>% as.character() %>% sort()
#countryList2 <- unique(countries@data$ISO2.x) %>% as.character() %>% sort()
#Genreating the author list
tempAuthor <- articles$Authors %>% as.character()
AuthorList <- unique(unlist(strsplit(tempAuthor,", "))) %>% sort()
tempUni <- articles$Place.of.Publish..1st.author. %>% as.character()
#UniversityList <- unique(articles$Place.of.Publish..1st.author.) %>% as.character() %>% sort()
UniversityList <- unique(unlist(strsplit(tempUni,", "))) %>% sort()
#Generating map Type List
MapTypeList <- c("WORK", "FIRSTPUB", "RESTPUB", "ALLPUB")
#A mapping
#mapping <- read.csv('./data/ISO2Name.csv')
countryList <- countries@data$NAME %>% as.character()
isoList <- countries@data$ISO2 %>% as.character()
names(isoList) <- countryList