R Markdown

library(CGPfunctions)
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readxl)
ESSClusterstat <- read_excel("/Users/janfredrikhovden/Dropbox/DBXPAGAANDEARBEID/Statistikk/Rworkdir/ESS/ESSClusterstat.xlsx", 
    sheet = "POLARDATA")

receive<-ESSClusterstat[1:48,]
qual2<-ESSClusterstat[1:53,]
qual<-ESSClusterstat[-c(7:12,25:30,44:48),]
consq<-ESSClusterstat[-c(7:12,25:30,44:48),]

class <- read_excel("/Users/janfredrikhovden/Dropbox/DBXPAGAANDEARBEID/Statistikk/Rworkdir/ESS/ESSClusterstat.xlsx", sheet = "CLASS")

classdk<-class[1:96,]
classdk2<-classdk[c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # positive
classdk3<-classdk[-c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # negative

classno<-class[97:192,]
classno2<-classno[c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # positive
classno3<-classno[-c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # negative

classse<-class[193:288,]
classse2<-classse[c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # positive
classse3<-classse[-c(1:6,13:18,73:76,25:30,37:42,81:84,49:54,61:66,89:92),] # negative

# note: exclude minorities & non-citizens

change <- read_excel("/Users/janfredrikhovden/Dropbox/DBXPAGAANDEARBEID/Statistikk/Rworkdir/ESS/ESSClusterstat.xlsx", sheet = "CHANGE")

changeconq<-change[37:72,]
changequal<-change[1:36,]
changereceive<-change[73:96,]
newggslopegraph(receive,cntryreceive,receive14,RECEIVE, Title = "How many immigrants should be received?", SubTitle = "Percentages 2014  (Majority citizens N=9,570)")

newggslopegraph(receive,cntryreceive,receive02,RECEIVE, Title = "How many immigrants should be received?", SubTitle = "Percentages 2002  (Majority citizens N=9,570)")

newggslopegraph(qual,cntryqual,qual14,QUAL, Title = "How important are immigrants qualifications?", SubTitle = "Percentages 2014 (Majority citizens N=9,570)", Caption = "Scale 0 (extremely unimportant) to 10 (extremely important), 0-3=unimportant, 4-6=neutral, 7-10=important")

newggslopegraph(qual,cntryqual,qual02,QUAL, Title = "How important are immigrants qualifications?", SubTitle = "Percentages 2002  (Majority citizens N=9,570)", Caption = "Scale 0 (extremely unimportant) to 10 (extremely important), 0-3=unimportant, 4-6=neutral, 7-10=important")

newggslopegraph(qual,cntryconsq,consq14,CONSQ, Title = "Consequences of immigration?", SubTitle = "Percentages 2014 (Majority citizens N=9,570)", Caption = "Scale 0 (negative) to 10 (positive), 0-3=worse, 4-6=neutral, 7-10=better")

newggslopegraph(qual,cntryconsq,consq02,CONSQ, Title = "Consequences of immigration?", SubTitle = "Percentages 2002 (Majority citizens N=9,570)", Caption = "Scale 0 (negative) to 10 (positive), 0-3=worse, 4-6=neutral, 7-10=better")

newggslopegraph(classdk3,fraction,fraction14,Question, Title = "CLASS VARIATIONS (DENMARK)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(classdk2,fraction,fraction14,Question, Title = "CLASS VARIATIONS (DENMARK)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(classno3,fraction,fraction14,Question, Title = "CLASS VARIATIONS (NORWAY)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(classno2,fraction,fraction14,Question, Title = "CLASS VARIATIONS (NORWAY)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(classse3,fraction,fraction14,Question, Title = "CLASS VARIATIONS (SWEDEN)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(classse2,fraction,fraction14,Question, Title = "CLASS VARIATIONS (SWEDEN)", SubTitle = "Percentages 2014  (Majority citizens N=*)")

newggslopegraph(changeconq,cntry,Margin2,Question, Title = "COUNTRY CHANGES", SubTitle = "Percentages  (Majority citizens N=*), controlled for generation")

newggslopegraph(changequal,cntry,Margin2,Question, Title = "COUNTRY CHANGES", SubTitle = "Percentages  (Majority citizens N=*), controlled for generation")

newggslopegraph(changereceive,cntry,Margin2,Question, Title = "COUNTRY CHANGES", SubTitle = "Percentages  (Majority citizens N=*), controlled for generation")