This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
# change the order | |
restaurant_df_long$scales <- factor(restaurant_df_long$scales, levels = c('Strongly agree', 'Agree', 'Strongly disagree','Disagree', 'Neutral')) | |
ggplot(data = restaurant_df_long, aes(x = restaurant, | |
y = signedCount, | |
fill = scales)) + | |
geom_col(width = 0.5) + | |
geom_text(aes(label = count), | |
position = position_stack(vjust = 0.5)) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
library(ggplot2) | |
scales <- c('Strongly agree', 'Agree', 'Neutral', 'Disagree', 'Strongly disagree') | |
bananaBeeNames <- rep('BananBee', 5) | |
bananaBeeRating <-c(1, 2, 3, 4, 5) | |
# convert disagree to be negative | |
signedBananaBeeRating <-c(1, 2, 3, -4, -5) | |
sweetRedNames <- rep('SweetRed', 5) | |
sweetRedRating <- c(5, 4, 3, 2, 1) | |
signedSweetRedRating <- c(5, 4, 3, -2, -1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
restaurant_df <- data.frame(restaurant=c('SweetRed', 'BananaBee'), | |
stronglyAgree=c(5,1), | |
agree=c(4,2), | |
neutral = c(3,3), | |
disagree=c(2,4), | |
stronglyDisagree=c(1,5)) | |
#column names with space! | |
colnames(restaurant_df) <- c('Restaurant',"Strongly Agree", "Agree", "Neutral", "Disagree", "Strongly disagree") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
install.packages('HH') | |
``` | |
```{r} | |
HH::likert(Restaurant ~ ., restaurant_df, main="I had great dining experience") | |
``` |