LinePlot: Compare Groups Based on Trajectory Plots

Description Usage Arguments Value Author(s) Examples

View source: R/statVisual.R

Description

Compare groups based on trajectory plots. Trajectories belonging to different groups will have different colors.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
LinePlot(
    data, 
    x, 
    y, 
    sid,
    group = NULL, 
    xFlag = FALSE,
    points = TRUE, 
    point.size = 1, 
    theme_classic = TRUE, 
    xlab = x, 
    ylab = y, 
    title = "Trajectory plot", 
    xLevel = NULL,
    addThemeFlag = TRUE,
    ...)

Arguments

data

A data frame. Rows are subjects; Columns are variables describing the subjects.

x

character. The column name of data that indicates the time.

y

character. The column name of data that indicates the variable on y axis

sid

character. The column name of data that indicates the subject id.

group

character. The column name of data that indicates the subject groups. The trajectories of subjects in the same group will have the same color.

xFlag

logical. Indicate if x should be treated as continuous (xFlag=TRUE)

points

logical. Indicates if points will be added to the trajectories on the coordinate (x, y).

point.size

numeric. size of the data points on the trajectories

theme_classic

logical. Use classic background without grids (default: TRUE).

xlab

character. x axis label

ylab

character. y axis label

title

character. title of plot

xLevel

character. A character vector indicating the order of the elements of x to be shown on x-axis if is.null(x)==FALSE.

addThemeFlag

logical. Indicates if light blue background and white grid should be added to the figure.

...

other input parameters for facet & theme

Value

A list with the following 9 elements: data, layers, scales, mapping, theme, coordinates, facet, plot_env, and labels.

Author(s)

Wenfei Zhang <Wenfei.Zhang@sanofi.com>, Weiliang Qiu <Weiliang.Qiu@sanofi.com>, Xuan Lin <Xuan.Lin@sanofi.com>, Donghui Zhang <Donghui.Zhang@sanofi.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(longDat)

print(dim(longDat))
print(longDat[1:3,])

print(table(longDat$time, useNA = "ifany"))
print(table(longDat$grp, useNA = "ifany"))
print(table(longDat$sid, useNA = "ifany"))

print(table(longDat$time, longDat$grp))

statVisual(type = "LinePlot",
  data = longDat,
  x = 'time',
  y = 'y',
  sid = 'sid',
  group = 'grp')

LinePlot(
  data = longDat,
  x = 'time',
  y = 'y',
  sid = 'sid',
  group = 'grp')

statVisual documentation built on Feb. 21, 2020, 1:08 a.m.