Created
September 29, 2015 09:55
-
-
Save dantalus/a0eb091f05bf972e9449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Events and missing data report" | |
author: "Produced by the Clinical Research Facility - Cork" | |
date: "`r Sys.Date()`" | |
output: pdf_document | |
includes: | |
in_header: \usepackage{color} | |
keep_tex: true | |
--- | |
```{r source data, echo = FALSE, include = FALSE, warning = FALSE, error = FALSE} | |
source("data.R") | |
senator <- filter(senator, inclusion.at.least.3.chronic == "Yes") %>% | |
filter(exclusion.direct.admission.icu == "No") | |
j <- "Cork" | |
``` | |
```{r set centre/patient number 1, echo = FALSE, include = FALSE} | |
i <- 1 | |
``` | |
\textcolor{blue}{This report is for patient number \textbf{`r i`} | |
in \textbf{`r j`}.} | |
\rule{\textwidth}{1pt} | |
```{r create data frames, echo = FALSE, include = FALSE} | |
incl.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("inclusion")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
excl.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("exclusion")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
entry.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("studyentry")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
demo.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("demo")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
home.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("homesupport")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
cirs.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("cirs")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
cirs <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("cirs")) | |
ecg.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("ecg")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
ecg <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("ecg")) | |
mmse.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("mmse")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
mmse <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("mmse")) | |
nutr.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("nutr")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
nutr <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("nutr")) | |
barth.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("barth")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
barth <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("barth")) | |
adrrop.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("adrrop")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
adrrop <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("adrrop")) | |
geron.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("geron")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
geron <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("geron")) | |
labs.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("labs")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
eos.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("eos")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
fourtest.miss <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("fourtest")) %>% | |
propMiss() %>% | |
filter(nmiss > 0) %>% | |
select(variable) | |
fourtest <- filter(senator, patient == i & centre == j) %>% | |
select(starts_with("fourtest")) | |
patient.events <- filter(events, patient == i & centre == j) %>% | |
select(adr.type, event.adr.due.to.link, severity.of.event) | |
``` | |
\textcolor{blue}{Events} | |
\textcolor{red}{`r if (nrow(patient.events) == 0){"There are no events for this | |
patient. Please review the | |
chart."}`} | |
```{r print events, echo = FALSE, results = "asis"} | |
if (nrow(patient.events) > 0){ | |
print(xtable(patient.events), comment = FALSE) | |
} | |
``` | |
\rule{\textwidth}{1pt} | |
\textcolor{blue}{Missing Variables} | |
**Inclusion criteria:** | |
\textcolor{red}{`r if(nrow(incl.miss) > 0){gsub("inclusion.", "", | |
incl.miss$variable)}`} | |
`r if(nrow(incl.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**Exclusion criteria:** | |
\textcolor{red}{`r if(nrow(excl.miss) > 0){gsub("inclusion", "", | |
excl.miss$variable)}`} | |
`r if(nrow(excl.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**Study entry:** | |
\textcolor{red}{`r if(nrow(entry.miss) > 0){gsub("studyentry.", "", | |
entry.miss$variable)}`} | |
`r if(nrow(entry.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**Demographics:** | |
\textcolor{red}{`r if(nrow(demo.miss) > 0){gsub("demo.", "", | |
demo.miss$variable)}`} | |
`r if(nrow(demo.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**Home support** | |
\textcolor{red}{`r if(nrow(home.miss) > 0){gsub("homesupport.", "", | |
home.miss$variable)}`} | |
`r if(nrow(home.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**Labs** | |
\textcolor{red}{`r if(nrow(labs.miss) > 0){gsub("labs.", "", | |
labs.miss$variable)}`} | |
`r if(nrow(labs.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**End of Study** | |
\textcolor{red}{`r if(nrow(eos.miss) > 0){gsub("eos.", "", | |
eos.miss$variable)}`} | |
`r if(nrow(eos.miss) == 0){"No missing fields"}` | |
\vspace{2mm} | |
**CIRS** Was the CRIS marked as completed? | |
**`r ifelse(cirs$cirs.completed == 2 | is.na(cirs$cirs.completed), | |
"No", "Yes")`** | |
`r if (cirs$cirs.completed == 2 | is.na(cirs$cirs.completed)){ | |
paste("The reason the CRIS was not completed was: ", cirs$cirs.why.not)}` | |
`r if(nrow(cirs.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(cirs.miss) > 0){gsub("cirs.", "", | |
cirs.miss$variable)}`} | |
\vspace{2mm} | |
**ECG** Was the ECG marked as completed? | |
**`r ifelse(ecg$ecg.completed == 2 | is.na(ecg$ecg.completed), | |
"No", "Yes")`** | |
`r if (ecg$ecg.completed == 2 | is.na(ecg$ecg.completed)){ | |
paste("The reason the CRIS was not completed was: ", ecg$ecg.why.not)}` | |
`r if(nrow(ecg.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(ecg.miss) > 0){gsub("ecg.", "", ecg.miss$variable)}`} | |
\vspace{2mm} | |
**MMSE** Was the MMSE marked as completed? | |
**`r ifelse(mmse$mmse.completed == 2 | is.na(mmse$mmse.completed), | |
"No", "Yes")`** | |
`r if (mmse$mmse.completed == 2 | is.na(mmse$mmse.completed)){ | |
paste("The reason the CRIS was not completed was: ", mmse$mmse.why.not)}` | |
`r if(nrow(mmse.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(mmse.miss) > 0){gsub("mmse.", "", | |
mmse.miss$variable)}`} | |
\vspace{2mm} | |
**Nutrition** Was the nutrition assessment marked as completed? | |
**`r ifelse(nutr$nutr.completed == 2 | is.na(nutr$nutr.completed), | |
"No", "Yes")`** | |
`r if (nutr$nutr.completed == 2 | is.na(nutr$nutr.completed)){ | |
paste("The reason the CRIS was not completed was: ", nutr$why.not)}` | |
`r if(nrow(nutr.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(nutr.miss) > 0){gsub("nutr.", "", | |
nutr.miss$variable)}`} | |
\vspace{2mm} | |
**Barthel** Was the Barthel marked as completed? | |
**`r ifelse(barth$barth.completed == 2 | is.na(barth$barth.completed), | |
"No", "Yes")`** | |
`r if (barth$barth.completed == 2 | is.na(barth$barth.completed)){ | |
paste("The reason the CRIS was not completed was: ", barth$barth.why.not)}` | |
`r if(nrow(barth.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(barth.miss) > 0){gsub("barth.", "", | |
barth.miss$variable)}`} | |
\vspace{2mm} | |
**ADRROP** Was the ADRROP form marked as completed? | |
**`r ifelse(adrrop$adrrop.completed == 2 | is.na(adrrop$adrrop.completed), | |
"No", "Yes")`** | |
`r if (adrrop$adrrop.completed == 2 | is.na(adrrop$adrrop.completed)){ | |
paste("The reason the CRIS was not completed was: ", | |
adrrop$adrrop.why.not)}` | |
`r if(nrow(adrrop.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(adrrop.miss) > 0){gsub("adrrop.", "", | |
adrrop.miss$variable)}`} | |
\vspace{2mm} | |
**Gerontonet** Was the Gerontonet form marked as completed? | |
**`r ifelse(geron$geron.completed == 2 | is.na(geron$geron.completed), | |
"No", "Yes")`** | |
`r if (geron$geron.completed == 2 | is.na(geron$geron.completed)){ | |
paste("The reason the CRIS was not completed was: ", | |
geron$geron.why.not)}` | |
`r if(nrow(geron.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(geron.miss) > 0){gsub("geron.", "", | |
geron.miss$variable)}`} | |
\vspace{2mm} | |
**Four test** Was the FourTest form marked as completed? | |
**`r ifelse(fourtest$fourtest.completed == 2 | | |
is.na(fourtest$fourtest.completed), | |
"No", "Yes")`** | |
`r if (fourtest$fourtest.completed == 2 | is.na(fourtest$fourtest.completed)){ | |
paste("The reason the CRIS was not completed was: ", | |
fourtest$fourtest.why.not)}` | |
`r if(nrow(fourtest.miss) == 0){"No missing fields"}` | |
\textcolor{red}{`r if(nrow(fourtest.miss) > 0){gsub("fourtest.", "", | |
fourtest.miss$variable)}`} | |
\rule{\textwidth}{1pt} | |
\newpage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment