Plotting Likert Scale in R

Viewed 164

I am completely new to R and self taught - using for 5 days with help of YouTube videos.

I want to plot Likert survey responses but struggling to work out or find how.

There are eight questions with 561 responses on a 5 point scale. A ninth question has the survey participant respond with either yes or no.

Ideally, I want something like a goem_jitter showing the dispersal of responses and I can colour these dependent on the yes/no response to a 9th question.

The data set I've read in shows 9 obvs. of 562 variables.

I can recreate a plot for one participants response using this code.

opinionv3 %>%
  filter(question %in% c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8")) %>%
  ggplot(aes(x = question, y = p1)) +
  geom_jitter() +

I'd appreciate any advice.

1 Answers

Reading between the lines, I think you may want something like this (to better show the data than geom_jitter would):

ggplot(opinionv3, aes(p1)) +
  geom_bar(stat='count') +
  facet_wrap(~question)

enter image description here

Or, if you want to show the points using jitter, perhaps combine this with a violin plot to show the distribution better:

ggplot(opinionv3, aes(question, p1)) +
  geom_violin() +
  geom_jitter(height = 0.1)

enter image description here

Some dummy data:

opinionv3 = data.frame(
  question = rep(paste0('q', 1:5), each=100),
  p1 = c(sample(1:5,100,T, prob=c(1,2,3,4,2)), 
         sample(1:5,100,T, prob=c(1,5,2,2,6)), 
         sample(1:5,100,T, prob=c(4,2,5,1,2)), 
         sample(1:5,100,T, prob=c(7,1,1,2,2)), 
         sample(1:5,100,T, prob=c(1,1,1,1,1)) 
  )
)
Related