Skip to content

Instantly share code, notes, and snippets.

@adamcone
Created April 26, 2016 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcone/d16d68723bee568336dcc4da4aa2ccbb to your computer and use it in GitHub Desktop.
Save adamcone/d16d68723bee568336dcc4da4aa2ccbb to your computer and use it in GitHub Desktop.
```{r, echo = TRUE, warning = FALSE, message = FALSE}
# now I'll try out this function on the filtered data
#------------------------------------------------------
sales_bar = mutate(sales_f, Bin_Number = bin_numbers(DateTime, 13)) %>%
group_by(., Bin_Number) %>%
summarise(., Bin_Sale_Total = sum(Sale_Total))
# now, I'll plot the result
ggplot(data = sales_bar, aes(x = Bin_Number)) +
geom_bar(aes(weight = Bin_Sale_Total)) +
theme_bw() +
labs(title = "Revenue vs. Time (clean data)",
x = "Time (6-month bins)",
y = "Revenue ($)"
) +
theme(
axis.text.x = element_blank(),
axis.ticks.x = element_blank()
) +
scale_y_continuous(limits = c(0, 7e5))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment