plot_date {fabR} | R Documentation |
This function draws a lollipop plot of the values of time related column. the 'time' parameter uses lubridate syntax to specify the period of time to consider. Missing values can be given as input to non-valid and valid values separately, or grouped by another column. The output can be editable (using plotly library) or static (using ggplot2 library). The R-code is also editable for coding recycling purpose.
plot_date(
tbl = "dplyr::storms",
col = "annual",
filter = "c()",
negate = FALSE,
missing_values = "c()",
time = "day",
out = "ggplot2-cat",
group_by = NULL
)
tbl |
A character string or tibble specifying the input tibble |
col |
A character string specifying a column of interest |
filter |
A character string specifying the values to filter. (equivalent to 'values in'). This determines which values should be retained. It can be applied to both grouped and ungrouped data. |
negate |
If TRUE, return non-matching elements. |
missing_values |
Vector listing values to exclude from valid values. These values will not be excluded from counting - but will be displayed separately from valid values. |
time |
parameter following lubridate syntax to specify the period of time to consider. Can be ymd, mdy, year, months, etc. See lubridate documentation. |
out |
parameter that specifies the output expected: can be either 'ggplot2', 'plotly','ggplot2-code', 'plotly-code','ggplot2-cat' or 'plotly-cat'. ggplot2 renders a static plot, plotly a dynamic plot, code gives the code in a string (usable directly with eval/parse functions) and cat provides indented code in the console. |
group_by |
A character string of one column in the tbl that can be taken as a grouping column. The visual element will be grouped and displayed by this column. |
A lollipop plot object
{
##### Example 1 -------------------------------------------------------------
# cat output generated as a template when no argument provided
plot_date()
##### Example 2 -------------------------------------------------------------
# graph of number of storms per month
library(dplyr)
annual_storms <-
dplyr::storms %>% sample_n(100) %>%
mutate(annual = as_any_date(paste(year,month,day),"ymd"))
plot_date(
tbl = annual_storms,
col = "annual",
time = "month",
out = "ggplot2")
}