View source: R/visualization.R
plot_lines  R Documentation 
The typical use of this function is to represents trends of average along some categorical variable.
plot_lines(
fml,
data,
time,
moderator,
mod.select,
mod.NA = TRUE,
smoothing_window = 0,
fun,
col = "set1",
lty = 1,
pch = c(19, 17, 15, 8, 5, 4, 3, 1),
legend_options = list(),
pt.cex = 2,
lwd = 2,
dict = NULL,
mod.title = TRUE,
...
)
fml 
A formula of the type 
data 
Data frame containing the variables of the formula. Used only if the argument ‘fml’ is a formula. 
time 
Only if argument ‘fml’ is a vector. It should be the vector of ‘time’ identifiers to average over. 
moderator 
Only if argument ‘fml’ is a vector. It should be a vector of conditional values to average over. This is an optional parameter. 
mod.select 
Which moderators to select. By default the top 5 moderators in terms of frequency (or in terms of the value of fun in case of identical frequencies) are displayed. If provided, it must be a vector of moderator values whose length cannot be greater than 10. Alternatively, you can put an integer between 1 and 10. 
mod.NA 
Logical, default is 
smoothing_window 
Default is 0. The number of time periods to average over.
Note that if it is provided the new value for each period is the average of
the current period and the 
fun 
Function to apply when aggregating the values on the time variable.
Default is 
col 
The colors. Either a vector or a keyword (“Set1” or “paired”). By default those are the “Set1” colors colorBrewer. This argument is used only if there is a moderator. 
lty 
The line types, in the case there are more than one moderator. By default it is equal to 1 (ie no difference between moderators). 
pch 
The form types of the points, in the case there are more than one moderator. By default it is equal to \8codec(19, 17, 15, 8, 5, 4, 3, 1). 
legend_options 
A list containing additional parameters for the function

pt.cex 
Default to 2. The 
lwd 
Default to 2. The width of the lines. 
dict 
A dictionnary to rename the variables names in the axes and legend.
Should be a named vector. By default it s the value of 
mod.title 
Character scalar. The title of the legend in case there is a
moderator. You can set it to 
... 
Other arguments to be passed to the function 
This function returns invisibly the output data.table containing the processed data used for plotting.
Laurent Berge
data(airquality)
plot_lines(Ozone ~ Day, airquality)
plot_lines(Ozone ~ Day  Month, airquality)
plot_lines(Ozone ~ Month  cut(Day, 8), airquality)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.