Description Usage Arguments Details Value Examples
View source: R/ggplot_spaghetti.R
This function allows the user to create spaghetti plots for individuals with time varying covariates. You can also break this down into subgroups to analyze different trentds.
1 2 |
y |
This is the y-axis parameter to specify. Generally it is a continuous variable. |
id |
This is the id parameter that identifies the unique individuals or units. |
time |
This is the time vector and must be numeric. |
alpha |
Scalar value between [0,1] that specifies the transparencey of the lineplots. |
method |
Character value that specifies which type of method to use for fitting. Optional methods come from stat_smooth() funciton. |
jit |
Scalar value that specifies how much you want to jitter each individual observation. Useful if many of the values share the same y values at a time point. |
group |
Specifies a grouping variable to be used, and will plot it by color on one single plot. |
wrap |
Another possible grouping variable, but this will use 'facet_wrap()' to create separate plots for each grouping variable. |
scales |
Specify the scales paremeter for 'facet_wrap()' in ggplot2. |
Note that the data must be in long format.
Plots a time series data by each individual/unit with group trends overlayed.
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.