Skip to content

Instantly share code, notes, and snippets.

@TracyYXChen
Created April 1, 2022 22:23
Show Gist options
  • Save TracyYXChen/c5b26233d9c7021aeba037e8e8537e6b to your computer and use it in GitHub Desktop.
Save TracyYXChen/c5b26233d9c7021aeba037e8e8537e6b to your computer and use it in GitHub Desktop.
dvBar03
```{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