1

Creating example data frame

Item <- c("EO1_PS", "EO1_OS", "EO2_PS", "EO2_OS")
SA  <- c(0, 36, 0, 27 )
A <- c(0, 64, 0, 73)
N <- c(0,0,0, 0)
D <- c(0, 0, 0, 0)
SD <- c(0, 0, 0, 0)
NAP <- c(100, 0, 100, 0)

df <- data.frame(Item, SA, A, N, D, SD, NAP)

Rename Columns (for legend)

df <- df  %>%
rename("Strongly Agree" = SA,
"Agree" = A,
"Neutral" = N,
"Disagree" = D,
"Strongly Disagree" = SD,
"Not Applicable" = NAP)

Plot the data

plot(likert(df), legend.position="right", plot_percentage=True) +
scale_fill_manual(values = brewer.pal(n=5,"PiYPu"), breaks = c("Strongly Agree", "Agree",
"Neutral","Disagree","Strongly Disagree", "Not Applicable"))

The percentages on each bar and labels of y axis (EO1_PS, EO1_OS, ....)is not showing!

user12256545
  • 2,755
  • 4
  • 14
  • 28

0 Answers0