Make seeding event duration vs event size table

make_duration_size_table(
  results = NULL,
  required_var = c("event_duration", "event_size", "R0"),
  spread_var = "event_duration",
  spread_value = "R0",
  rename_var = "event_size",
  renamed_var = "Transmission event size vs. Transmission event duration (days)"
)

Arguments

results

The output from summarised_end_r0

required_var

A character string of variables to select for the table.

spread_var

A character variable indicating the variable to spread.

spread_value

A character variable to use as the spreading value.

rename_var

A character variable to rename.

renamed_var

A character variable indicating the name of the renamed variable

Value

A data.frame comparing transmission event size with duration

Examples

## Example results <- data.frame(R0 = runif(10, 0, 1), event_duration = 1:10, event_size = rep(c(1,2), 5), tmp = 1:10) make_duration_size_table(results)
#> Transmission event size vs. Transmission event duration (days) #> 1 1 #> 2 2 #> 1 2 3 4 #> 1 0.0807501375675201 - 0.600760886212811 - #> 2 - 0.834333037259057 - 0.157208441523835 #> 5 6 7 8 #> 1 0.0073994412086904 - 0.497777388663962 - #> 2 - 0.466393497306854 - 0.289767244597897 #> 9 10 #> 1 0.732881987001747 - #> 2 - 0.772521511185914
## Code make_duration_size_table
#> function (results = NULL, required_var = c("event_duration", #> "event_size", "R0"), spread_var = "event_duration", spread_value = "R0", #> rename_var = "event_size", renamed_var = "Transmission event size vs. Transmission event duration (days)") #> { #> out <- results %>% dplyr::select(required_var) %>% tidyr::spread(key = spread_var, #> value = spread_value) %>% dplyr::rename_at(.vars = rename_var, #> ~paste0(renamed_var)) %>% dplyr::mutate_all(~tidyr::replace_na(., #> " - ")) #> return(out) #> } #> <bytecode: 0x55a6b075eee8> #> <environment: namespace:WuhanSeedingVsTransmission>