line_plot | R Documentation |
line_plot
allows for flexible visualization of repeated
measures variables from panel_data
frames.
line_plot(
data,
var,
id = NULL,
wave = NULL,
overlay = TRUE,
show.points = TRUE,
subset.ids = FALSE,
n.random.subset = 9,
add.mean = FALSE,
mean.function = "lm",
line.size = 1,
alpha = if (overlay) 0.5 else 1
)
data |
Either a |
var |
The unquoted name of the variable of interest. |
id |
If |
wave |
If |
overlay |
Should the lines be plotted in the same panel or each in their own facet/panel? Default is TRUE, meaning they are plotted in the same panel. |
show.points |
Plot a point at each wave? Default is TRUE. |
subset.ids |
Plot only a subset of the entities' lines? Default is NULL,
meaning plot all ids. If TRUE, a random subset (the number defined by
|
n.random.subset |
How many entities to randomly sample when |
add.mean |
Add a line representing the mean trend? Default is FALSE.
Cannot be combined with |
mean.function |
The mean function to supply to |
line.size |
The thickness of the plotted lines. Default: 0.5 |
alpha |
The transparency for the lines and points. When
|
The ggplot
object.
data("WageData")
wages <- panel_data(WageData, id = id, wave = t)
line_plot(wages, lwage, add.mean = TRUE, subset.ids = TRUE, overlay = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.