Learn R Programming

exuber (version 0.3.0)

autoplot.radf: Plotting and tidying radf objects

Description

autoplot.radf takes an radf object and returns a (list of ) ggplot2 objects. fortify.radf takes an radf object and converts it into a data.frame. ggarrange is a wrapper of arrangeGrob(), which can be used directly after autoplot to place grobs on a page.

Usage

# S3 method for radf
autoplot(object, cv = NULL, include = FALSE,
  select = NULL, option = c("gsadf", "sadf"), min_duration = 0,
  arrange = TRUE, ...)

# S3 method for radf fortify(model, data, cv = NULL, include = FALSE, select = NULL, option = c("gsadf", "sadf"), ...)

ggarrange(...)

Arguments

object

An object of class radf().

cv

An object of class "cv". The output of mc_cv(), wb_cv() or sb_cv()

include

If not FALSE, plot all variables regardless of rejecting the NULL at the 5% significance level.

select

If not NULL, only plot with names or column number matching this regular expression will be executed.

option

Whether to apply the "gsadf" or "sadf" methodology. Default is "gsadf".

min_duration

The minimum duration of an explosive period for it to be reported. Default is 0.

arrange

If FALSE returns a list of ggplot2 object, otherwise it grobs the plots on a single page.

...

further arguments passed to method. Specify common characteristics like ggplot2::xlab, that are later passed to ggplot chain. For multiple changes, the input in the argument should be in a list.

model

An object of class radf().

data

original dataset, not used (required by generic fortify() method).

Details

arrange offers flexibility to the user by specifying the desired output. If arrange = FALSE, the individual plots can be modified after creation the then rearranged with the ggarrange function into a single plot.

Examples

Run this code
# NOT RUN {
dta <- data.frame(psy1 = sim_psy1(n = 100), psy2 = sim_psy2(n = 100))

dta %>%
  radf() %>%
  autoplot(ncol = 2)


# For custom plotting with ggplot2
dta %>%
  radf() %>%
  fortify()
# }

Run the code above in your browser using DataLab