Description Usage Arguments Value Examples
Generate distribution data as absolute levels
1 2 3 4 5 6 | generateDistributionData(
fromDate = Sys.Date() - 1 * 365,
toDate = Sys.Date(),
mynames = c("product_a", "product_b", "product_c"),
initDist = c(1000, 500, 800)
)
|
fromDate |
the beginning of the time series |
toDate |
the end of the time series |
mynames |
the names to attach to the generated data |
initDist |
the vector of initial distributions in total numbers |
a tibble with the generated data one column for each element in name
1 2 3 4 5 6 7 8 9 10 11 | library(ggplot2)
library(dplyr)
library(tidyr)
generateDistributionData(
Sys.Date() - 30, Sys.Date(),
c("product_a", "product_b", "product_c"), c(20, 50, 10)
) %>%
gather(type, distribution, -date) %>%
ggplot(aes(y = distribution, x = date, color = type)) +
geom_line() +
theme_minimal()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.