Load the data
library(tidyverse)
library(p8105.datasets)
library(plotly)
data("rest_inspec")
rest_inspec =
rest_inspec %>%
filter(grade %in% c("A","B","C"),
cuisine_description %in% c("American",
"French",
"Chinese",
"Seafood",
"Italian",
"Japanese",
"Pizza")) %>%
select(dba, cuisine_description, boro, street, building, zipcode, grade, grade_date, score, record_date, action, critical_flag, violation_description, inspection_type, inspection_date)
rest_inspec %>%
filter(cuisine_description == "Japanese") %>%
plot_ly(x = ~street,
y = ~boro)
## No trace type specified:
## Based on info supplied, a 'histogram2d' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#histogram2d
rest_inspec %>%
plot_ly(labels = ~cuisine_description,
type = "pie")
rest_inspec %>%
plot_ly(x = ~boro,
y = ~score)
## No trace type specified:
## Based on info supplied, a 'bar' trace seems appropriate.
## Read more about this trace type -> https://plot.ly/r/reference/#bar