whocov / trend_analysis_public

Public version of the trend analysis infrastructure
https://asmodee-infrastructure-handbook.netlify.app/
Other
2 stars 3 forks source link

Documentation feedback #33

Closed nsbatra closed 3 years ago

nsbatra commented 3 years ago

Hi @thibautjombart , I will post feedback here as I encounter issues while reading through the documentation

nsbatra commented 3 years ago

Section 2.1

I think in the lower-left corner, that `finaldat[date].Rmd should actually be .rds Also minor issue in the text above this image: Two asterisks ** appearing from incomplete bold formatting

image

nsbatra commented 3 years ago

It would be great to have the file that creates this matrix, so we can edit it if necessary.

image

nsbatra commented 3 years ago

Reading 4.2 candidate model creations, I couldn't help but think there is a simpler way that avoids the regular expressions code. Here it is:

https://epirhandbook.com/characters-and-strings.html#unite-split-and-arrange

# load packages
pacman::p_load(tidyverse)

# expand grid - note: use NA instead of ""
mod_content_grid <- expand.grid(c(NA, "tests"),
                                "date",
                                c(NA, "weekday"),
                                c(NA, "cases_lag_1"))

#print
mod_content_grid
#>    Var1 Var2    Var3        Var4
#> 1  <NA> date    <NA>        <NA>
#> 2 tests date    <NA>        <NA>
#> 3  <NA> date weekday        <NA>
#> 4 tests date weekday        <NA>
#> 5  <NA> date    <NA> cases_lag_1
#> 6 tests date    <NA> cases_lag_1
#> 7  <NA> date weekday cases_lag_1
#> 8 tests date weekday cases_lag_1

# Use unite() to combine all columns, with sep = " + " and na.rm = TRUE
mod_content <- mod_content_grid %>% 
     unite(
          col = "models",            # name of the new united column
          1:ncol(mod_content_grid),  # columns to unite
          sep = " + ",               # separator to use in united column
          remove = TRUE,             # if TRUE, removes input cols from the data frame
          na.rm = TRUE               # if TRUE, missing values are removed before uniting
     )

# print
mod_content
#>                                 models
#> 1                                 date
#> 2                         tests + date
#> 3                       date + weekday
#> 4               tests + date + weekday
#> 5                   date + cases_lag_1
#> 6           tests + date + cases_lag_1
#> 7         date + weekday + cases_lag_1
#> 8 tests + date + weekday + cases_lag_1

# check classes
class(mod_content)
#> [1] "data.frame"
class(mod_content$models)
#> [1] "character"

Created on 2021-07-14 by the reprex package (v2.0.0)

You end with a data frame with column of character values, but could easily be converted to list if preferred.

nsbatra commented 3 years ago

4.3 and 4.4 are very impressive work! Really impactful methodological advancements it seems!

Also I just noticed the typo in "hanbook" in the URL
https://asmodee-infrastructure-hanbook.netlify.app/final-considerations.html

thibautjombart commented 3 years ago

Thanks a lot for all this. Should be all addressed via 5c3655107529be368faf5f8003364454acc4c917