Closed aspina7 closed 5 years ago
from kate: A weird thing -- I originally had a line list with data from 2016--now. I filtered to only include 2019. So when I am running attack rate by week, there is a piece of code that keeps all the factor levels, which mucks up my AR by week.
# counts and cumulative counts by week
cases <- linelist_cleaned %>%
arrange(date_of_admission) %>% # arrange by date of onset
count(epiweek, .drop = FALSE) %>% # count all epiweeks and include zero counts
mutate(cumulative = cumsum(n)) # add a cumulative sum
Z: I guess you need to add a new filter statement in there for epiweek
K: Fair
K: Similar issue with describe_admissions_by_epiweek and describe_exits_by_epiweek -- not sure how to filter there
Z: I forget what disease template you're on?
K: Cholera. But it's basically that i have unused factor levels in epiweek -- any easy way to drop them?
Z: Convert it to character. We added that in there so that any missing weeks would be highlighted.
K: Can I do that in the initial creation, or needs to be in that statement only?
Z: You can do it in the initial creation if you'd like, so you can select factor = FALSE in the epiweek creation. If you want the ability to count missing weeks, then you can use factor_aweek() after you filter your data and it will create levels that span the range of your data.
K: follow-up, changed it to this so i could keep unused levels but only in 2019
descriptive(linelist_cleaned, "epiweek", coltotals = TRUE, rowtotals = TRUE) %>%
filter(grepl("2019", epiweek)) %>%
augment_redundant("_n$" = " (n)") %>% # modify _n to (n)
rename_redundant("prop" = "%") %>% # rename proportions to %
kable(digits = 2)
Z:is epiweek a character in your linelist or a factor? Oh, duh, you can just drop those levels with forcats::fct_drop(): https://forcats.tidyverse.org/reference/fct_drop.html But yeah, it shouldn't matter too much. I think what you have above is good.
Making a flow chart to guide users through the templates would be helpful
closing as have the cleaned hackathon to-do-list in place
Morning @zkamvar - Think probably the easiest thing to do is to start a bullet list, then for each bullet sit it out so that it contains the name of person who raised issue in brackets, then the disease template (cholera, ajs, measles, meningitis) they were using, followed by a dash and the codechunk (or general) and then the error or issue. followed by solution in double brackets, at the end of it once fixed. e.g.: