ggMyTS: Easily plot time series trends with 'ggplot'

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/ggMyTS.R

Description

ggMyTS is primarily designed to be used with a data frame created with meltMyTS (QMSS).

Usage

1
2
ggMyTS(df, varlist, line = TRUE, point = TRUE, pointsize = 3,
  linewidth = 1.25, ...)

Arguments

df

The data frame in which to look for variables to be plotted. Typically created with meltMyTS (QMSS)

varlist

A character string or vector naming the variable(s) in df to plot. If varlist is not specified, then all variables in df will be used.

line

Should lines be plotted? Defaults to TRUE.

point

Should points be plotted? Defaults to TRUE.

pointsize

Size of the points, if point == TRUE.

linewidth

Width of the line(s), if line == TRUE.

...

Other options that will be passed to geom_line and geom_point. See examples.

Value

A ggplot object.

Note

At least one of line or point must be TRUE.

Author(s)

Jonah Gabry <jsg2201@columbia.edu>. See ggplot for the author of the ggplot function.

See Also

meltMyTS

Examples

1
2
3
4
5
6
7
8
## Not run: 
keep.vars <- c("year", "n.confinan", "fulltime")
plot.dat <- meltMyTS(mv.ts.object = by.year.ts,
                     time.var = "year", keep.vars = keep.vars)
ggMyTS(plot.dat, varlist = c("n.confinan", "fulltime"))
ggMyTS(plot.dat, "n.confinan", color = "forestgreen", point = F, linetype = 2)

## End(Not run)

jgabry/QMSS_package documentation built on May 19, 2019, 7:18 a.m.