knitr::opts_chunk$set(echo = TRUE)
library(MadsR)
library(dplyr)
library(ggplot2)

MadsR - let's get to the fun part.

MadsR is a package designed for my own uses with data from the danish microbiological system MADS.

Installation

devtools::install_github("marcmtk/MadsR")

Functions implemented

This package provides 6 functions to assist with epidemiological analyses of MADS data and 2 functions to generate MADS like data for testing purposes.

Examples

Consider the dataset provided in analyser-like.csv with read_csv vs read_mads

df <- read.csv("./extdata/analyser-like.csv")
str(df)
head(df)
df <- read_mads("./extdata/analyser-like.csv", "analyser")
str(df)
head(df)

Let's filter some cases and look at the results

cases <- filter_cases(df, result=="Positiv", min.days.to.new.episode=14)
table(cases$hosp_afd, cases$episode)
table(cases$sl)

Now let's look at a since last plot, after all there may be an epidemic out there!

since_last(df) %>% slplot()
since_last(df) %>% filter(hosp_afd=="S V") %>% slplot()
filter(df, hosp_afd == "S V") %>% since_last() %>% slplot()

Note the difference between plot 2 and plot 3. It is very important that time since last positive case is computed after relevant filtering.

Last useful functions, tallying by department and heatmapping the results:1

tbd <- tally_by_department(df, "patient", result == "Positiv")
tally_map(tbd)
filter(tbd, hosp_afd != "AP ") %>% tally_map

Session info

sessionInfo()


marcmtk/MadsR documentation built on May 21, 2019, 11:43 a.m.