epiverse-trace / episoap

[Not published - under active development] A Store of Outbreak Analytics Pipelines Provided as Rmarkdown Report Templates
https://epiverse-trace.github.io/episoap/
Other
4 stars 2 forks source link

Preparing data for {EpiNow2} #117

Closed CarmenTamayo closed 1 month ago

CarmenTamayo commented 5 months ago

On the skeleton of the transmissibility pipeline, the object count_var is created to represent the column of the input dataset that contains the number of cases (in this case count_var = "n") Then {incidence2} is used to create another dataset (dat_i_day) with daily incidence where the argument count = count_var Subsequently, the {EpiNow2} code chunk uses dat_i_day as input data for Rt estimation (both global and regional), and requires the column with cases to be named "confirmed" In the current script, this is done through:

res_epinow2_group <- dat_i_day %>% dplyr::rename( confirm = .data[[count_var]], date = date_index, region = .data[[group_var]] ) However, the count variable is no longer named "n" but "count", which results in an error when renaming

Is there something I'm missing @Bisaloo? Could I change this to .data[["counts"]], since it's always going to come from an incidence2 object?

CarmenTamayo commented 5 months ago

Related to this, when using incidence2 to obtain daily incidence data, the name "date" is used instead of the object "date_var" - is there a reason for this? would it be better to use the object?

I.e. here:

dat_i_day <- dat_raw %>% incidence("date", interval = 1L, counts = count_var, groups = group_var )

Bisaloo commented 3 months ago

Is there something I'm missing @Bisaloo? Could I change this to .data[["counts"]], since it's always going to come from an incidence2 object?

Yes please, update it with "counts".

Related to this, when using incidence2 to obtain daily incidence data, the name "date" is used instead of the object "date_var" - is there a reason for this? would it be better to use the object?

Both options should be equivalent and there is no specific reason why one was used over the other here. Please feel free to use your favourite option and update if necessary.