Skip to content

Commit 10b102f

Browse files
committed
Adding prev patients with AKIs to summary
1 parent b686002 commit 10b102f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Create summary statistics final dataset.R

+13-5
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,24 @@ tmp <- crea.rep %>%
221221
distinct(PatientID, NoAKIepisodes) %>%
222222
group_by(PatientID) %>%
223223
filter(NoAKIepisodes == max(NoAKIepisodes)) %>%
224-
ungroup()
224+
ungroup()
225+
226+
225227

226228

227229
dataset_summary <- dataset_summary %>%
228-
bind_rows(data.frame(Characteristic = "Mean number of AKI episodes (sd)",
229-
Value = str_c(round(mean(tmp$NoAKIepisodes), 1),
230+
bind_rows(data.frame(Characteristic = "Patients with at least one AKI (%)",
231+
Value = str_c(format(sum(tmp$NoAKIepisodes > 0) , big.mark = ","),
230232
" (",
231-
round(sd(tmp$NoAKIepisodes), 1),
233+
round(sum(tmp$NoAKIepisodes > 0)/nrow(tmp)*100, 1),
232234
")",
233-
sep = "")))
235+
sep = ""))) %>%
236+
bind_rows(data.frame(Characteristic = "Mean number of AKI episodes (sd)",
237+
Value = str_c(round(mean(tmp$NoAKIepisodes), 1),
238+
" (",
239+
round(sd(tmp$NoAKIepisodes), 1),
240+
")",
241+
sep = "")))
234242

235243

236244

0 commit comments

Comments
 (0)