Hello, I am in the process of finishing an rmd file as a report for a project. Everything so far has worked as intended, but I am unable to load a plot that is embedded into the file after knitting it. So if I run the code chunk before I knit the file, it produces the plot correctly as expected. But when I knit the file, the final product fails to render and tells me there is an error.
Here is what the code chunk for the plot looks like:
q4_2016_v2 %>%
mutate(weekday = wday(started_at, label = TRUE)) %>%
group_by(member_casual, weekday) %>%
summarise(number_of_rides = n()
,average_duration = mean(ride_length)) %>%
arrange(member_casual, weekday) %>%
ggplot(aes(x = weekday, y = number_of_rides, fill = member_casual)) +
geom_col(position = "dodge") +
labs(title="Number of Rides per Day of the Week",
subtitle="Sample of Cyclistic Members and Casual users",
caption="Data collected from Cyclistic Bikes",
y='Number of Rides',
x='Day of the Week',
fill = "Type of User")
Here is the error I receive:
processing file: Data-Analytics-Capstone-Report.Rmd
|.............................. | 57% [unnamed-chunk-1]
Quitting from lines 259-273 [unnamed-chunk-1] (Data-Analytics-Capstone-Report.Rmd)
Error in `q4_2016_v2 %>% mutate(weekday = wday(started_at, label = TRUE)) %>% group_by(
member_casual, weekday) %>% summarise(number_of_rides = n(),
average_duration = mean(ride_length)) %>% arrange(member_casual, weekday) %>%
ggplot(aes(x = weekday, y = number_of_rides, fill = member_casual))`:
! could not find function "%>%"
Execution halted
The lines listed (259-273) match up with the code chunk above. In this report I have listed all the steps I took to get to the final code chunk above, but none of them are set to run when rendered (using the {r}). I noticed that the knit couldn't find the %>% function, so I went to where I loaded the packages and had them run when rendered, but got another error. I don't know if that is where the problem is but this is the error for that:
processing file: Data-Analytics-Capstone-Report.Rmd
|....................... | 44% [unnamed-chunk-1]
Quitting from lines 33-40 [unnamed-chunk-1] (Data-Analytics-Capstone-Report.Rmd)
Error in `contrib.url()`:
! trying to use CRAN without setting a mirror
Backtrace:
1. utils::install.packages("tidyverse")
2. utils::contrib.url(repos, "source")
Execution halted
Any help would be great.