-
Notifications
You must be signed in to change notification settings - Fork 1
/
meta-summary-tables.Rmd
116 lines (91 loc) · 3.35 KB
/
meta-summary-tables.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
title: "meta-survival-tables"
author: "Meg Hutch"
date: "6/21/2021"
output: html_document
---
```{r}
library(tidyverse)
```
```{r}
cns <- read.csv("meta_tables/surivival_analysis_cpns_resultsneuro_postCentral.csv")
pns <- read.csv("meta_tables/surivival_analysis_cpns_resultsneuro_postPeripheral.csv")
#both <- read.csv("meta_tables/surivival_analysis_cpns_resultsneuro_postBoth.csv")
#binary_results <- read.csv("meta_tables/surivival_analysis_binary_results.csv")
```
```{r}
# cnps results
cns$Neuro <- "CNS"
pns$Neuro <- "PNS"
#both$Neuro <- "Both"
results <- rbind(cns, pns)
result_table <- results %>%
filter(Analysis == "") %>%
select(-Analysis, -Weight.random) %>%
rename("Analysis" = X,
"Estimate" = Estimate.)
# binary_results
# binary_result_table <- binary_results %>%
# filter(Analysis == "") %>%
# select(-Analysis, -Weight.random) %>%
# rename("Analysis" = X,
# "Estimate" = Estimate.)
```
Rename factors
```{r}
result_table$Analysis <- recode_factor(result_table$Analysis,
"time_deceased_reg_elix" = "Time to Mortality",
"time_severe_reg_elix" = "Time to Severity",
"time_first_discharge_reg_elix" = "Time to First Discharge")
# binary_result_table$Analysis <- recode_factor(binary_result_table$Analysis,
# "time_deceased_reg_elix" = "Time to Mortality",
# "time_severe_reg_elix" = "Time to Severity",
# "time_first_discharge_reg_elix" = "Time to First Discharge")
```
Clean up table
```{r}
result_table <- result_table %>%
rename("Hazard Ratio" = Estimate,
"Neuro Status" = Neuro) %>%
select(Analysis, `Neuro Status`, `Hazard Ratio`, p.value, P.value, everything())
# binary_result_table <- binary_result_table %>%
# rename("Hazard Ratio" = Estimate) %>%
# select(Analysis, `Hazard Ratio`, p.value, P.value, everything())
```
Save manuscript table
```{r}
# cnps
manuscript_table <- result_table %>%
select(Analysis, `Neuro Status`, `Hazard Ratio`, P.value) %>%
arrange(desc(Analysis))
write.csv(manuscript_table, "meta_tables/Manuscript_Table.csv", row.names = FALSE)
# binary
# binary_manuscript_table <- binary_result_table %>%
# select(Analysis, `Hazard Ratio`, P.value) %>%
# arrange(desc(Analysis))
#
# write.csv(binary_manuscript_table, "meta_tables/Manuscript_Table_Binary_Results.csv", row.names = FALSE)
```
Save supplementary table
```{r}
# cnps
supp_table <- result_table %>%
mutate(I2 = paste(I2, I2.CI),
tau2 = paste(tau2, tau2.CI)) %>%
select(Analysis, `Neuro Status`, `Hazard Ratio`, p.value, Predict.CI, I2, tau2) %>%
rename("Prediction Interval" = Predict.CI,
"P-value" = p.value) %>%
arrange(desc(Analysis))
write.csv(supp_table, "meta_tables/Supplementary_Table.csv", row.names = FALSE)
# # binary
# binary_supp_table <- binary_result_table %>%
# mutate(I2 = paste(I2, I2.CI),
# tau2 = paste(tau2, tau2.CI)) %>%
# select(Analysis, `Hazard Ratio`, p.value, Predict.CI, I2, tau2) %>%
# rename("Prediction Interval" = Predict.CI,
# "P-value" = p.value) %>%
# arrange(desc(Analysis))
#
#
# write.csv(binary_supp_table, "meta_tables/Supplementary_Table_Binary_Results.csv", row.names = FALSE)
```