outbreak: Outbreak reconstruction tools

Description Usage Arguments Examples

View source: R/outbreak.R

Description

Using corrected indices produced by cor_index, this function produces defoliating insect outbreak reconstructions at the tree level.

Usage

1
outbreak(ci, min = 4, sd = -1.28, prop = TRUE)

Arguments

ci

df: corrected indices

min

int: minimum length of outbreaks

sd

dbl: minimum standard deviation

prop

logical: controls output format

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
outbreak( cor_index( ob_host, ob_nonhost))

foo <- cor_index( ob_host, ob_nonhost))
sites <- foo %>%
  dplyr::mutate( site = substr( tree_id, 1, 3)) %>%
  .$site %>%
  unique()
bar <- list()
for (i in 1:length(sites)) {
  bar[[i]] <- foo %>%
    dplyr::mutate(site = substr(tree_id, 1, 3)) %>%
    dplyr::filter(site == groups[i]) %>%
    outbreak() %>%
    dplyr::mutate(site = groups[i])
}
outbreaks <- dplyr::bind_rows(bar)

## End(Not run)

toddellis/outbreakR documentation built on March 9, 2020, 12:21 a.m.