Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

likert.bar.plot is adding some groups to the plot twice #124

Open
ski11ionaire opened this issue Jan 7, 2022 · 1 comment
Open

likert.bar.plot is adding some groups to the plot twice #124

ski11ionaire opened this issue Jan 7, 2022 · 1 comment

Comments

@ski11ionaire
Copy link

Trying to plot a likert output using the below data:

structure(list(`Likelihood of attending more frequently` = structure(c(4L, 
4L, 4L, 3L, 4L, 4L, 3L, 4L, 5L, 4L, 4L, 4L, 4L, 5L, 3L, 5L, 4L, 
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 4L, 5L, 4L, 3L, 2L, 3L, 
3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 5L, 4L, 4L, 4L, 3L, 
4L, 5L, 3L, 3L, 2L, 4L, 4L, 3L, 4L, 1L, 3L, 3L, 4L, 5L, 4L, 4L, 
4L, 4L, 4L, 3L, 4L, 4L, 5L, 4L, 2L, 5L, 3L, 2L, 3L, 3L, 5L, 4L, 
4L, 2L, 3L, 2L, 4L, 5L, 3L, 4L, 4L, 4L, 4L, 5L, 4L, 4L, 3L, 4L, 
4L, 4L, 5L, 3L, 3L, 4L, 3L, 4L, 3L, 3L, 5L, 5L, 4L, 4L, 5L, 2L, 
1L, 4L, 4L, 4L, 1L, 4L, 3L, 2L, 4L, 4L, 4L, 4L, 5L, 4L, 5L, 4L, 
5L, 4L, 2L, 5L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 3L, 
3L, 4L, 4L, 4L, 5L, 5L, 4L, 5L, 5L, 3L, 2L, 4L, 5L, 5L, 1L, 5L, 
2L, 1L, 5L, 4L, 1L, 4L, 5L, 4L, 2L, 4L, 4L, 4L, 5L, 3L, 2L, 5L, 
5L, 5L, 4L), .Label = c("Highly unlikely", "Somewhat unlikely", 
"Neither likely nor unlikely", "Somewhat likely", "Highly likely"
), class = "factor"), Reason = structure(c(1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
3L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("Class times conflict with my schedule", 
"I am not interested in the content offered", "I don't have time", 
"I don't have transportation", "I don't know where to find information on classes, programs, and events", 
"Other", "There are not classes near me"), class = "factor")), row.names = c(NA, 
-180L), class = "data.frame")

I created likert item using:
like<-likert(freq[, c(1), drop=FALSE], grouping = freq$Reason)

The output of the likert indicates 7 groups
List of 6
$ results :'data.frame': 7 obs. of 7 variables:
..$ Group : Factor w/ 7 levels "Class times conflict with my schedule",..: 1 2 3 4 5 6 7
..$ Item : Factor w/ 1 level "Likelihood of attending more frequently": 1 1 1 1 1 1 1
..$ Highly unlikely : num [1:7] 0 12.5 3.57 0 0 ...
..$ Somewhat unlikely : num [1:7] 0 12.5 8.33 0 8.33 ...
..$ Neither likely nor unlikely: num [1:7] 11.54 37.5 22.62 0 4.17 ...
..$ Somewhat likely : num [1:7] 76.9 25 51.2 100 70.8 ...
..$ Highly likely : num [1:7] 11.5 12.5 14.3 0 16.7 ...
$ items :'data.frame': 180 obs. of 1 variable:
..$ Likelihood of attending more frequently: Factor w/ 5 levels "Highly unlikely",..: 4 4 4 3 4 4 3 4 5 4 ...
$ grouping: Factor w/ 7 levels "Class times conflict with my schedule",..: 1 1 1 1 1 1 1 1 1 1 ...
$ factors : NULL
$ nlevels : int 5
$ levels : chr [1:5] "Highly unlikely" "Somewhat unlikely" "Neither likely nor unlikely" "Somewhat likely" ...

  • attr(*, "class")= chr "likert"

image

Not sure why it is doing this.

@ski11ionaire
Copy link
Author

Both from the source code of likert.bar.plot and from the image it looks as if for the bars the unwrapped group labels are used, while for the percentage labels the wrapped ones are used. Hence we end up with duplicated groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant