Question
Question: * The `restaurants` data frame has a variable `GRADE DATE` which `read_csv` interprets as a character variable. * In the code chunk below, add
Question:
* The `restaurants` data frame has a variable `GRADE DATE` which `read_csv` interprets as a character variable. * In the code chunk below, add a new variable `date`, derived from `GRADE DATE`, but so that `restaurants %>% pull(date) %>% class()` gives "Date" and not "character" (there's a check of that in the second code chunk below). * Next, filter out any inspections that do not include a grade (I've provided that code for you.) * Take the resulting data frame, group by date, and summarize the proportion of `GRADE` equal to "A" for each date. + This is a little challenging, but just remember that the proportion will be the sum of the grades that are equal to "A" on each date divided by the total number n of grades on that date. * Finally, make a scatter plot with `date` on the x-axis, the proportion of A's on the y-axis, and include a smooth---that is, include `+ geom_smooth()` in your code for the plot. + If all went well, you should see a noticeable seasonal effect over the seven years represented in the data, as well as a big pandemic-related gap. + Don't worry if you get messages that one row was removed.
Could you please check where is wrong? :
```{r problem 2 b} restaurants <- restaurants |> mutate(GRADE.DATE(date)) restaurants_summarized <- restaurants |> filter(!is.na(GRADE)) |> summarise(GRADE ==A) restaurants_summarized |> ggplot(aes(x=date, y= the proportions of A)+ geom_smooth() ```
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started