Macarena Fernandez

Problem 1

#####DO NOT MODIFY THIS CHUNK
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Category<-c("Alpha","Beta","Zeta")
City<-c("Hong Kong","London","Nairobi")

my_dat<-expand_grid(Category,City)

set.seed(84684)

my_dat$Value<-sample(1:10,9,replace=T)
library(gganimate)
library(gifski)

ggplot(my_dat) +
  geom_col(aes(x = Category,
               y = Value,
               fill = City)) +
  transition_states(City,
                    transition_length = 1,
                    state_length = 1) +
  shadow_wake(wake_length = 0.5) +
  enter_fade() +
  exit_fade()

Problem 2

#####DO NOT MODIFY THIS CHUNK

Response<-c("Energize","Amazing","Great")
set.seed(9819)
Energize<-tibble(Company=rep("Energize",100),Output=rnorm(100,50,20))
set.seed(9819)
Amazing<-tibble(Company=rep("Amazing",100),Output=rnorm(100,50,10))
set.seed(9819)
Great<-tibble(Company=rep("Great",100),Output=rnorm(100,40,5))

my_dat<-bind_rows(Energize,Amazing,Great)

Problem 3

library(plotly)

Category<-seq(from=1,to=10)
Time<-seq(from=1,to=10)

dat3<-expand_grid(Category,Time)

set.seed(78957)
dat3$Quantity<-runif(100,0,10)
library(plotly)

fig1 <- ggplotly(ggplot(dat3,
                        aes(x = Category,
                            y = Quantity,
                            frame = Time)) +
                   geom_point() +
                   geom_segment(aes(x = Category,
                                    xend = Category,
                                    yend = 0)))
fig1