library("readr")
library("plyr")
library("grid")
library("dplyr")
library("tidyr")
library("likert")
leaders <- read_csv(
" Leader, Party, Very Good, Good, Neutral, Bad, Very Bad
Arlene Foster, DUP, 14.71, 36.64, 30.93, 12.31, 5.41
Martin McGuinness, Sinn Fein, 13.51, 30.63, 34.83, 9.92, 11.11
Mike Nesbitt, UUP, 13.51, 26.43, 27.63, 23.42, 9.01
Colum Eastwood, SDLP, 3.6, 15.62, 43.24, 27.63, 9.91
David Ford, Alliance, 8.11, 21.92, 27.63, 27.32, 15.02
Jim Allister, TUV, 17.12, 36.04, 17.41, 15.92, 13.51
Stephen Agnew, Green, 15.02, 30.93, 33.03, 12.31, 8.71
David McNarry, UKIP, 1.8, 8.11, 20.12, 32.13, 37.84
")
dfr <- leaders %>%
select(1,(ncol(.)):3) %>%
rename(Item = Leader) %>%
as.data.frame()
dfr
## Item Very Bad Bad Neutral Good Very Good
## 1 Arlene Foster 5.41 12.31 30.93 36.64 14.71
## 2 Martin McGuinness 11.11 9.92 34.83 30.63 13.51
## 3 Mike Nesbitt 9.01 23.42 27.63 26.43 13.51
## 4 Colum Eastwood 9.91 27.63 43.24 15.62 3.60
## 5 David Ford 15.02 27.32 27.63 21.92 8.11
## 6 Jim Allister 13.51 15.92 17.41 36.04 17.12
## 7 Stephen Agnew 8.71 12.31 33.03 30.93 15.02
## 8 David McNarry 37.84 32.13 20.12 8.11 1.80
lik <- likert(summary = dfr)
str(lik)
## List of 5
## $ results :'data.frame': 8 obs. of 6 variables:
## ..$ Item : chr [1:8] "Arlene Foster" "Martin McGuinness" "Mike Nesbitt" "Colum Eastwood" ...
## ..$ Very Bad : num [1:8] 5.41 11.11 9.01 9.91 15.02 ...
## ..$ Bad : num [1:8] 12.31 9.92 23.42 27.63 27.32 ...
## ..$ Neutral : num [1:8] 30.9 34.8 27.6 43.2 27.6 ...
## ..$ Good : num [1:8] 36.6 30.6 26.4 15.6 21.9 ...
## ..$ Very Good: num [1:8] 14.71 13.51 13.51 3.6 8.11 ...
## $ items : NULL
## $ grouping: NULL
## $ nlevels : num 5
## $ levels : chr [1:5] "Very Bad" "Bad" "Neutral" "Good" ...
## - attr(*, "class")= chr "likert"
## Item low neutral high mean sd
## 1 Arlene Foster 17.72 30.93 51.35 3.432990 1.0498732
## 2 Martin McGuinness 21.03 34.83 44.14 3.257732 1.1572088
## 3 Mike Nesbitt 32.43 27.63 39.94 3.112245 1.1830648
## 4 Colum Eastwood 37.54 43.24 19.22 2.752577 0.9357587
## 5 David Ford 42.34 27.63 30.03 2.795918 1.1837315
## 6 Jim Allister 29.43 17.41 53.16 3.295918 1.2939923
## 7 Stephen Agnew 21.02 33.03 45.95 3.326531 1.1285929
## 8 David McNarry 69.97 20.12 9.91 2.020408 1.0049321

plot(lik, ordered = FALSE)

plot(lik, legend = 'Rating'
, legend.position = 'bottom') +
ggtitle('Party Leader Ratings')

plot(lik, plot.percents = TRUE
, plot.percent.neutral = FALSE
, plot.percent.low = FALSE
, plot.percent.high = FALSE) +
ggtitle('Party Leader Ratings')

plot(lik, include.center = FALSE) +
ggtitle('Party Leader Ratings')

plot(lik, centered = FALSE)


plot(lik, center = 2.5, plot.percent.neutral = FALSE)


leaders_grup <- read_csv(
" Leader, Party, Designation, Very Good, Good, Neutral, Bad, Very Bad
Arlene Foster, DUP, Unionist, 14.71, 36.64, 30.93, 12.31, 5.41
Martin McGuinness, Sinn Fein, Nationalist, 13.51, 30.63, 34.83, 9.92, 11.11
Mike Nesbitt, UUP, Unionist, 13.51, 26.43, 27.63, 23.42, 9.01
Colum Eastwood, SDLP, Nationalist, 3.6, 15.62, 43.24, 27.63, 9.91
David Ford, Alliance, Other, 8.11, 21.92, 27.63, 27.32, 15.02
Jim Allister, TUV, Unionist, 17.12, 36.04, 17.41, 15.92, 13.51
Stephen Agnew, Green, Other, 15.02, 30.93, 33.03, 12.31, 8.71
David McNarry, UKIP, Unionist, 1.8, 8.11, 20.12, 32.13, 37.84
")
dfr_grup <- leaders_grup %>%
select(1,3,(ncol(.)):4) %>%
rename(Item = Designation) %>%
as.data.frame()
dfr_grup
## Leader Item Very Bad Bad Neutral Good Very Good
## 1 Arlene Foster Unionist 5.41 12.31 30.93 36.64 14.71
## 2 Martin McGuinness Nationalist 11.11 9.92 34.83 30.63 13.51
## 3 Mike Nesbitt Unionist 9.01 23.42 27.63 26.43 13.51
## 4 Colum Eastwood Nationalist 9.91 27.63 43.24 15.62 3.60
## 5 David Ford Other 15.02 27.32 27.63 21.92 8.11
## 6 Jim Allister Unionist 13.51 15.92 17.41 36.04 17.12
## 7 Stephen Agnew Other 8.71 12.31 33.03 30.93 15.02
## 8 David McNarry Unionist 37.84 32.13 20.12 8.11 1.80
lik_grup <- likert(summary = dfr_grup, grouping = dfr_grup$Leader)
summary(lik_grup)
## Group Item low neutral high mean sd
## 1 Arlene Foster Unionist 17.72 30.93 51.35 3.432990 1.0498732
## 2 Martin McGuinness Nationalist 21.03 34.83 44.14 3.257732 1.1572088
## 3 Mike Nesbitt Unionist 32.43 27.63 39.94 3.112245 1.1830648
## 4 Colum Eastwood Nationalist 37.54 43.24 19.22 2.752577 0.9357587
## 5 David Ford Other 42.34 27.63 30.03 2.795918 1.1837315
## 6 Jim Allister Unionist 29.43 17.41 53.16 3.295918 1.2939923
## 7 Stephen Agnew Other 21.02 33.03 45.95 3.326531 1.1285929
## 8 David McNarry Unionist 69.97 20.12 9.91 2.020408 1.0049321

plot(lik_grup, legend = 'Rating'
, legend.position = 'bottom') +
ggtitle('Party Leader Ratings')

dfr_grup <- leaders_grup %>%
filter(Designation == 'Nationalist') %>%
select(1,3,(ncol(.)):4) %>%
rename(Item = Designation) %>%
as.data.frame()
dfr_grup
## Leader Item Very Bad Bad Neutral Good Very Good
## 1 Martin McGuinness Nationalist 11.11 9.92 34.83 30.63 13.51
## 2 Colum Eastwood Nationalist 9.91 27.63 43.24 15.62 3.60
lik_grup <- likert(summary = dfr_grup, grouping = dfr_grup$Leader)
summary(lik_grup)
## Group Item low neutral high mean sd
## 1 Martin McGuinness Nationalist 21.03 34.83 44.14 3.257732 1.1572088
## 2 Colum Eastwood Nationalist 37.54 43.24 19.22 2.752577 0.9357587
plot(lik_grup, legend = 'Rating'
, legend.position = 'bottom') +
ggtitle('Nationalist Party Leader Ratings')

dfr_grup <- leaders_grup %>%
filter(Designation == 'Unionist') %>%
select(1,3,(ncol(.)):4) %>%
rename(Item = Designation) %>%
as.data.frame()
dfr_grup
## Leader Item Very Bad Bad Neutral Good Very Good
## 1 Arlene Foster Unionist 5.41 12.31 30.93 36.64 14.71
## 2 Mike Nesbitt Unionist 9.01 23.42 27.63 26.43 13.51
## 3 Jim Allister Unionist 13.51 15.92 17.41 36.04 17.12
## 4 David McNarry Unionist 37.84 32.13 20.12 8.11 1.80
lik_grup <- likert(summary = dfr_grup, grouping = dfr_grup$Leader)
summary(lik_grup)
## Group Item low neutral high mean sd
## 1 Arlene Foster Unionist 17.72 30.93 51.35 3.432990 1.049873
## 2 Mike Nesbitt Unionist 32.43 27.63 39.94 3.112245 1.183065
## 3 Jim Allister Unionist 29.43 17.41 53.16 3.295918 1.293992
## 4 David McNarry Unionist 69.97 20.12 9.91 2.020408 1.004932
plot(lik_grup, legend = 'Rating'
, legend.position = 'bottom') +
ggtitle('Unionist Party Leader Ratings')

plot(lik_grup, plot.percents = TRUE
, plot.percent.neutral = FALSE
, plot.percent.low = FALSE
, plot.percent.high = FALSE) +
ggtitle('Party Leader Ratings')

plot(lik_grup, include.center = FALSE) +
ggtitle('Party Leader Ratings')

plot(lik_grup, centered = FALSE)

plot(lik_grup, center = 2)

plot(lik_grup, center = 2.5, plot.percent.neutral = FALSE)
