Created
April 1, 2022 22:23
-
-
Save TracyYXChen/c5b26233d9c7021aeba037e8e8537e6b to your computer and use it in GitHub Desktop.
dvBar03
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) | |
restaurant_df_long <- data.frame(restaurant = c(bananaBeeNames, sweetRedNames), | |
count = c(bananaBeeRating, sweetRedRating), | |
signedCount = c(signedBananaBeeRating, signedSweetRedRating), | |
scales = rep(scales, 2) | |
) | |
restaurant_df_long | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment