Description Usage Arguments Value Examples
This function plots micro-panel (longitudinal) data from stored data.frame
or randomly generated panel data from GeneratePanel
function.
1 2 3 4 5 6 7 8 9 10 11 12 |
data |
A data frame containing the variables named in |
formula |
A two-sided |
group |
A grouping factor variable (vector), i.e. single identifier for each (trajectory). |
colour |
Character, which is a variable's name in data. The trajectories are distinguished by colour according to this variable. |
mean_traj_all |
Logical scalar. It indicates whether to show mean overall trajectory. Default is FALSE. |
mean_traj_group |
Logical scalar. It indicates whether to show mean trajectory by group. Default is FALSE. |
show_legend |
Logical scalar. It indicates whether to show cluster legend. Default is TRUE. |
title |
String. Is an optional title for a plot. Otherwise no title will used. |
x_title |
String. Is an optional title for x axis. Otherwise variable name after ~ in |
y_title |
String. Is an optional title for y axis. Otherwise variable name before ~ in |
Returns plot using package ggplot2.
1 2 3 4 5 6 7 8 9 10 11 | set.seed(123)
dataMale <- GeneratePanel(n = 50, Param = ParamLinear, NbVisit = 10)
dataMale$Gender <- "M"
dataFemale <- GeneratePanel(n = 50, Param = ParamLinear, NbVisit = 10)
dataFemale$ID <- dataFemale$ID + 50
dataFemale$Gender <- "F"
data <- rbind(dataMale, dataFemale)
PanelPlot(data = data, formula = Y ~ Time, group = "ID", colour = "Gender")
PanelPlot(data = data, formula = Y ~ Time, group = "ID", colour = "Gender", mean_traj_all = TRUE)
PanelPlot(data = data, formula = Y ~ Time, group = "ID", colour = "Gender", mean_traj_group = TRUE)
|
Warning messages:
1: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
2: In `[.data.table`(data, , ..colour) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
3: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
4: In `[.data.table`(setDT(data), , ..colour, ) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
`geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
Warning messages:
1: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
2: In `[.data.table`(data, , ..colour) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
3: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
4: In `[.data.table`(setDT(data), , ..colour, ) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
`geom_smooth()` using method = 'loess' and formula 'y ~ x'
Warning messages:
1: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
2: In `[.data.table`(data, , ..colour) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
3: In `[.data.table`(data, , ..group) :
Both 'group' and '..group' exist in calling scope. Please remove the '..group' variable in calling scope for clarity.
4: In `[.data.table`(setDT(data), , ..colour, ) :
Both 'colour' and '..colour' exist in calling scope. Please remove the '..colour' variable in calling scope for clarity.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.