## Summarize uniformly sampled trees conditional on n,x
## SKG
## April 2, 2020
## Pandemic times
#' Summarize sampled trees
#'
#' @param trees output from \code{simulate_many_bp}
#' @return data frame with the following columns
#' \describe{
#' \item{i_pos}{number of transmissions from a positive smear}
#' \item{n_pos}{number of positive smears}
#' \item{n}{cluster size}
#' }
#' @export
summarize_cond_trees <- function(trees){
out <- trees %>% dplyr::mutate(n1 = .data$cluster_size, n_pos1 = .data$cluster_pos) %>%
dplyr::group_by(.data$cluster_id) %>%
dplyr::summarize(i_pos = sum(.data$n_inf[.data$smear > 0]),
n_pos = .data$n_pos1[1],
n = .data$n1[1],
max_g = max(.data$gen)[1])
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.