Description Usage Arguments Value Examples
It is difficult to compare two timeerieses when you have more than one observation per timepoint without reducing all observations to a single statistical variable such as average or mean. This visualisation plots the median and the upper and lower 25 contineuos line between the medians ot the timepoints.
1 2 3 | f_plot_time(variable, time_variable, data_ls,
time_variable_as_factor = F, group = NULL, normalize = F,
time_unit = "day")
|
variable |
character vector naming the variable to be plotted |
time_variable |
character vector naming the timevariable to be plotted |
data_ls |
data_ls object generated by f_clean_data(), or a named list list( data = <dataframe>, numericals = < vector with column names of numerical columns>) |
time_variable_as_factor |
If TRUE will convert time_variable to a factor, this will equalize the distance between timepoints on the plots and drops the connective line between timepoints, Default: F |
group |
character vector naming the column to be used as grouping variable, Default: NULL |
normalize |
If TRUE y variable will be divided by x variable, usefull if y variable represents a cumulated sum, Default: F |
time_unit |
character vector used as an x-axis lable , Default: 'day' |
plot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
set.seed(1)
data = dplyr::sample_n( nycflights13::flights, 1000 )
data$is_ua = ifelse( data$carrier == 'UA', 'UA', 'other')
data$date = data$year * 10000 + data$month * 100 + data$day
data$date = lubridate::as_date( data$date )
data_ls = f_clean_data( data, replace_neg_values_with_zero = F)
f_plot_time( 'arr_delay', 'month', data_ls, group = 'is_ua', time_unit = 'month', time_variable_as_factor = T)
#without grouping
f_plot_time( 'arr_delay', 'month', data_ls, time_unit = 'month', time_variable_as_factor = F)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.