cv19rr: S3 methods for the cv19rr class

Description Usage Arguments Examples

Description

S3 methods for the cv19rr class

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## S3 method for class 'cv19rr'
print(x, ...)

## S3 method for class 'cv19rr'
plot(x, page = c(1, 2), main = "Kontakttal R", ...)

## S3 method for class 'cv19rr'
autoplot(
  object,
  lag = 7,
  caption_date = Sys.Date(),
  rib_col = "grey85",
  x_by = 5,
  xlim = c("2020-03-24", NA),
  y_marks = waiver(),
  ylim = c(NA, NA),
  ...
)

## S3 method for class 'cv19rr'
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  lag = 7,
  r2R = function(r) 1 + 4.7 * r,
  ...
)

Arguments

x

An object of class cv19rr

...

Unused arguments provided for compatibility with S3 methods

page

Which page of plots to display (1, 2, 3 or multiple)

main

The plot title

object

An object of class cv19rr

lag

Lag parameter

caption_date

Date to use in the caption

rib_col

Colour for the ribbon

x_by

Increment for the date on the x axis

xlim

Limits of the x axis (date) - if the second element is blank then the caption date is used as the maximum extent of the range

y_marks

Marks to show on the y axis

ylim

Limits for the y axis

row.names

Unused arguments provided for compatibility with S3 methods

optional

Unused arguments provided for compatibility with S3 methods

r2R

function to convert daily growth rates to reproduction number

tests

Number of tests to normalise against

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library("Covid19RR")
dat <- download_data()
mod <- estimate_cv19rr(dat, silent=TRUE)
require("ggplot2")
# Replicate figure 12.1:
autoplot(mod, date = "2020-10-25",
    y_marks = c(0, 0.5, 1, 1.5, 2), ylim = c(0, 2.5))
ggsave("figur 12.1.pdf", height=7, width=11)
# Replicate figure 12.2:
autoplot(mod, caption_date = "2020-10-25", xlim = c("2020-02-23", NA),
    y_marks = c(0, 1, 2), ylim = c(0, 3))
ggsave("figur 12.2.pdf", height=7, width=11)

# To produce graphs from a data frame:
mydf <- as.data.frame(mod)
Covid19RR:::autoplot.cv19rr(mydf)

ku-awdc/Covid19RR documentation built on Feb. 2, 2021, 12:49 p.m.