I’m not sure if you checked recently, but the git-pages site is up to date with the latest release, and you see an end-to-end example of the execution in this article.
It will just produce a table of results, however. I have a few scripts that will plot the results however, and can share them here:
# assuming you have your irDesign and buildOptions created, execute the analysis
# and store results in executeResults
executeResults <- CohortIncidence::executeAnalysis(connectionDetails = connectionDetailsSample,
incidenceDesign = irDesign,
buildOptions = buildOptions)
# filter to the overall rates: no age, gender or year stratification
overall <- executeResults %>% filter(is.na(AGE_ID) & is.na(GENDER_ID) & is.na(START_YEAR)) %>% arrange(OUTCOME_ID)
View(overall)
# filter to by gender
byGender <- executeResults %>% filter(is.na(AGE_ID) & !is.na(GENDER_ID) & is.na(START_YEAR)) %>% arrange(OUTCOME_ID, GENDER_ID)
View(byGender)
# filter to by year
byYear <- executeResults %>% filter(is.na(AGE_ID) & is.na(GENDER_ID) & !is.na(START_YEAR)) %>% arrange(OUTCOME_ID, START_YEAR)
View(byYear)
plotByYear(byYear)
# filter to by gender, by year
View(executeResults %>% filter(is.na(AGE_ID) & !is.na(GENDER_ID) & !is.na(START_YEAR)) %>% arrange(OUTCOME_ID, START_YEAR) )
plotByGenderByYear(executeResults)
View(executeResults %>% filter(!is.na(AGE_ID) & is.na(GENDER_ID) & is.na(START_YEAR)))
plotByAge(executeResults)
View(executeResults %>% filter(!is.na(AGE_ID) & !is.na(GENDER_ID) & is.na(START_YEAR)))
plotByAgeByGender(executeResults)
These are the plotting functions that were used in the above:
plotByGenderByYear <- function(irData) {
plotData <- irData %>% filter(is.na(AGE_ID) & !is.na(GENDER_ID) & !is.na(START_YEAR)) %>%
arrange(OUTCOME_ID, START_YEAR)
ggplot2::ggplot(plotData, ggplot2::aes(x = START_YEAR, y = INCIDENCE_RATE_P100PY, color=GENDER_NAME, shape=as.factor(OUTCOME_NAME))) +
ggplot2::geom_point(size=3)
}
plotByYear <- function(irData) {
plotData <- irData %>% filter(is.na(AGE_ID) & is.na(GENDER_ID) & !is.na(START_YEAR)) %>%
arrange(OUTCOME_ID, START_YEAR)
ggplot2::ggplot(plotData, ggplot2::aes(x = START_YEAR, y = INCIDENCE_RATE_P100PY, shape=as.factor(OUTCOME_NAME))) +
ggplot2::geom_point(size = 3)
}
plotByAge <- function(irData) {
plotData <- irData %>% filter(!is.na(AGE_ID) & is.na(GENDER_ID) & is.na(START_YEAR)) %>%
arrange(OUTCOME_ID, AGE_ID) %>%
mutate(AGE_X = forcats::fct_reorder(factor(AGE_GROUP_NAME), AGE_ID))
ggplot2::ggplot(plotData, ggplot2::aes(x = AGE_X, y = INCIDENCE_RATE_P100PY, shape=as.factor(OUTCOME_NAME))) +
ggplot2::geom_point(size = 3, position = ggplot2::position_dodge(width=.5))
}
plotByAgeByGender <- function(irData) {
plotData <- irData %>% filter(!is.na(AGE_ID) & !is.na(GENDER_ID) & is.na(START_YEAR)) %>%
arrange(OUTCOME_ID, AGE_ID) %>%
mutate(AGE_X = forcats::fct_reorder(factor(AGE_GROUP_NAME), AGE_ID))
ggplot2::ggplot(plotData, ggplot2::aes(x = AGE_X, y = INCIDENCE_RATE_P100PY, color=GENDER_NAME, shape=as.factor(OUTCOME_NAME))) +
ggplot2::geom_point(size = 3, position = ggplot2::position_dodge(width=.5)) + ggplot2::labs(x = "Age", y = "Events per 100 Person-Years", shape = "Outcome", color = "Gender") + ggplot2::scale_color_discrete()
}