'Create a Calendar illustration of the busiest days during the year (total) Divvy Bikes
I'm using the following:
// install.packages("tidyverse")
// install.packages("rmarkdown")
// install.packages("bookdown")
// install.packages("plyr") #Used for merging multiple CSV's into one dataframe
// install.packages("modeest")
// install.packages("calendR")
// install.packages("readxl")
// install.packages("ggplot2")
// install.packages("ggplot")
// install.packages("dplyr")
daily_count <- divvy_data %>%
count(started_on) %>%
as.data.frame(daily_count) %>%
select(-c(started_on)) %>%
unlist(use.names = FALSE)
scale_fn <- function(x) { x / sqrt(sum(x^2)) } # placing values within a 0-1 by ratio and to be used in the calendR
calendR(year = 2022,
special.days = scale_fn(daily_count),
gradient = TRUE,
special.col = rgb(0, 0.2, .7, alpha = 1),
low.col = "white")
It says: Error in divvy_data %>% count(started_on) %>% as.data.frame(daily_count) %>% : could not find function "%>%"
Can anyone help me? Thank you! enter image description here
Solution 1:[1]
Try this:
daily_count <- divvy_data %>%
count(started_on) %>%
data.frame() %>%
select(-c(started_on)) %>%
unlist(use.names = FALSE)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TarJae |
