Description Usage Arguments Value Examples
View source: R/podlove_plot_regression.R
Wrapper function to take data from podlove_get_and_clean()
and creates
a regression plot with several graphical options.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
df_tidy_data |
a tidy table of downloads created by |
point_in_time |
Measurement point in time relative to episode release in hours or days. Can be a single value or a vector of integers. |
time_unit |
Time unit of |
predictor |
a single predictor variable for downloads, typically a time
or order based variable such as |
plot_type |
the type of plot that should be generated. accepts a string from the list "point" (dot plot), "line" (line plot") or "area (area plot) |
label |
boolean switcher to label the plotted points with episode titles (default: FALSE) |
regline |
boolean switcher if the plot should contain a regression line (default: TRUE) |
ribbon |
boolean switcher if the plot should contain a confidence ribbon (default: TRUE) |
stylize |
boolean switcher if the plot should be beautifed (default TRUE).
if FALSE, styling can be added later with |
print_model |
boolean switcher if the regression model should be printed |
print_plot |
boolean switcher if the plot should print a graph |
a ggplot2 object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
# prepare linear regression data for downloads on day 3 by episode release date
downloads <- podlove_create_example()
# create dot plot
podlove_plot_regression(downloads, point_in_time = 3, plot_type = "point")
# create line plot with labels
podlove_plot_regression(downloads, point_in_time = 3, plot_type = "point",
label = TRUE)
# create area plot without regression line and ribbon
podlove_plot_regression(downloads, point_in_time = 3, predictor = post_datehour,
plot_type = "point", regline = FALSE, ribbon = FALSE)
# create dot plot, add another theme
podlove_plot_regression(downloads, point_in_time = 3, predictor = post_datehour,
plot_type = "point", stylize = FALSE) +
ggthemes::theme_economist()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.