Skip to content

Commit 6d841c1

Browse files
committed
adding code and plots
1 parent e1db760 commit 6d841c1

21 files changed

+929
-159
lines changed

app.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ library(bslib)
55
library(purrr)
66
library(stringr)
77

8-
source("data/code_versions.R")
98
source("global.R")
109

11-
10+
1211
ui <- fluidPage(
1312
includeCSS("www/style.css"),
1413
shinyjs::useShinyjs(),
@@ -47,7 +46,9 @@ ui <- fluidPage(
4746
nav_panel("Remotes",
4847
navset_card_tab(
4948
nav_panel("Q1",
50-
remotesq1_ui("rq1"))
49+
remotesq1_ui("rq1")),
50+
nav_panel("Q2",
51+
remotesq2_ui("rq2"))
5152
)
5253
)
5354
)
@@ -66,6 +67,7 @@ server <- function(input, output, session) {
6667
mergeq2_server("mq2")
6768

6869
remotesq1_server("rq1")
70+
remotesq2_server("rq2")
6971

7072
}
7173

data/code_versions.R

Lines changed: 5 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,7 @@
1-
code_versions <- list(
2-
dot1 = '#| echo: false
3-
#| include: false
1+
# This file is just used to quickly make all the images in case
2+
# we need to refresh them in the future
43

5-
#install.packages("tidyverse")
64
library(tidyverse)
7-
library(broom)
8-
library(knitr)
9-
library(haven)
10-
11-
surv<-read_sas("whas500.sas7bdat")%>%
12-
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
13-
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
14-
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
15-
CVD_C = ifelse(CVD==1, "Yes", "No"))
16-
17-
18-
pubgraph1<-
19-
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP )) +
20-
geom_point() +
21-
facet_grid(rows = vars(CVD_C), cols = vars(GENDER_C)) +
22-
labs(title="Diastolic and Systolic Blood Pressure by Gender and Cardiovascular Disease Status",
23-
x="Systolic Blood Pressure",
24-
y="Diastolic Blood Pressure",
25-
caption="Data source: Survival 500 data")
26-
27-
ggplot2::ggsave(filename="pubgraph1.eps",
28-
plot=pubgraph1,
29-
device="eps",
30-
dpi=1200,
31-
width=15,
32-
height=10)
33-
ggplot2::ggsave(filename="pubgraph1.jpg",
34-
plot=pubgraph1,
35-
device="jpg",
36-
dpi=1200,
37-
width=15,
38-
height=10)',
39-
dot2 = '#| echo: false
40-
#| include: false
41-
42-
#install.packages("tidyverse")
43-
library(tidyverse)
44-
library(broom)
45-
library(knitr)
46-
library(haven)
47-
48-
surv<-read_sas("whas500.sas7bdat")%>%
49-
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
50-
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
51-
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
52-
CVD_C = ifelse(CVD==1, "Yes", "No"))
53-
54-
55-
pubgraph1<-
56-
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP )) +
57-
geom_point() +
58-
facet_grid(rows = vars(CVD_C), cols = vars(GENDER_C))+
59-
60-
labs(title="Diastolic and Systolic Blood Pressure by Gender and Cardiovascular Disease Status",
61-
x="Systolic Blood Pressure",
62-
y="Diastolic Blood Pressure",
63-
caption="Data source: Survival 500 data")+
64-
geom_smooth(mapping=aes(group=NA, x=SYSBP, y=DIASBP))+
65-
theme(panel.spacing = unit(0.5,"cm",data=NULL),
66-
strip.text.x=element_text(size=14, color="red",face="bold.italic"),
67-
strip.text.y=element_text(size=7, color="blue",face="bold")
68-
)
69-
ggplot2::ggsave(filename="pubgraph1.eps",
70-
plot=pubgraph1,
71-
device="eps",
72-
dpi=1200,
73-
width=15,
74-
height=10)
75-
ggplot2::ggsave(filename="pubgraph1.jpg",
76-
plot=pubgraph1,
77-
device="jpg",
78-
dpi=1200,
79-
width=15,
80-
height=10)',
81-
dot3 = '#| echo: false
82-
#| include: false
83-
84-
#install.packages("tidyverse")
85-
library(tidyverse)
86-
library(broom)
87-
library(knitr)
88-
library(haven)
89-
90-
surv<-read_sas("whas500.sas7bdat")%>%
91-
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
92-
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
93-
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
94-
CVD_C = ifelse(CVD==1, "Yes", "No"))
95-
96-
97-
pubgraph2 <-
98-
ggplot(data = surv, mapping = aes(x =DIASBP , y =SYSBP )) +
99-
geom_point() +
100-
facet_grid(rows = vars(AFB_C), cols = vars(GENDER_C)) +
101-
labs(title="Systolic and Diasolic Blood Pressure by Gender and Disease Status",
102-
y="Systolic Blood Pressure",
103-
x="Diastolic Blood Pressure",
104-
caption="Data source: Survival 500 data")+
105-
geom_smooth(mapping=aes(group=NA, x=DIASBP,y=SYSBP))+
106-
theme(panel.spacing = unit(0.5,"cm",data=NULL),
107-
strip.text.x=element_text(size=12, color="blue",face="bold.italic"),
108-
strip.text.y=element_text(size=12, color="blue",face="bold"),
109-
plot.title=element_text(face="italic", color="Blue"),
110-
panel.grid.minor=element_line(linetype="solid",color="black"),
111-
plot.background=element_rect(fill="lightblue",color="black")
112-
)
113-
114-
ggplot2::ggsave(filename="pubgraph2.eps",
115-
plot=pubgraph2,
116-
device="eps",
117-
dpi=1200,
118-
width=15,
119-
height=10)
120-
ggplot2::ggsave(filename="pubgraph2.jpg",
121-
plot=pubgraph2,
122-
device="jpg",
123-
dpi=1200,
124-
width=15,
125-
height=10)',
126-
dots1 = "Test4",
127-
dotJA1 = "Journal Update",
128-
dotJA2 = "Journal Update again..."
129-
)
130-
131-
saveRDS(code_versions, file = "data/code_versions.rds")
5+
list.files("data/", full.names = TRUE) |>
6+
keep(str_detect, "dot") |>
7+
map(source)

data/code_versions.rds

-1015 Bytes
Binary file not shown.

data/dot1.R

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# EXPLORING BLOOD PRESSURE DATA
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1<-
12+
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP, color = CVD_C, shape = GENDER_C)) +
13+
geom_point()
14+
15+
ggplot2::ggsave(filename="images/pubgraph1-dot1.jpg",
16+
plot=pubgraph1,
17+
device="jpg",
18+
dpi = 72,
19+
width=450,
20+
height=400,
21+
units = "px"
22+
)

data/dot2.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# CLEANING-UP PLOT FOR JOUNRAL A
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1<-
12+
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP)) +
13+
geom_point() +
14+
facet_grid(rows = vars(CVD_C), cols = vars(GENDER_C)) +
15+
labs(title="Diastolic and Systolic Blood Pressure by Gender and Cardiovascular Disease Status",
16+
x="Systolic Blood Pressure",
17+
y="Diastolic Blood Pressure",
18+
caption="Data source: Survival 500 data")
19+
20+
ggplot2::ggsave(filename="images/pubgraph1-dot2.jpg",
21+
plot=pubgraph1,
22+
device="jpg",
23+
dpi = 72,
24+
width=450,
25+
height=400,
26+
units = "px")

data/dot3.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# LOOKING AT JOURNAL B
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1<-
12+
ggplot(data = surv, mapping = aes(x =DIASBP , y =SYSBP )) +
13+
geom_point() +
14+
facet_grid(rows = vars(AFB_C), cols = vars(GENDER_C)) +
15+
labs(title="Systolic and Diasolic Blood Pressure by Gender and Disease Status",
16+
y="Systolic Blood Pressure",
17+
x="Diastolic Blood Pressure",
18+
caption="Data source: Survival 500 data")+
19+
geom_smooth(mapping=aes(group=NA, x=DIASBP,y=SYSBP))
20+
21+
ggplot2::ggsave(filename="images/pubgraph1-dot3.jpg",
22+
plot=pubgraph1,
23+
device="jpg",
24+
dpi = 72,
25+
width=450,
26+
height=400,
27+
units = "px")

data/dot4.R

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# FINALISING JOURNAL B
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1 <-
12+
ggplot(data = surv, mapping = aes(x =DIASBP , y =SYSBP )) +
13+
geom_point() +
14+
facet_grid(rows = vars(AFB_C), cols = vars(GENDER_C)) +
15+
labs(title="Systolic and Diasolic Blood Pressure by Gender and Disease Status",
16+
y="Systolic Blood Pressure",
17+
x="Diastolic Blood Pressure",
18+
caption="Data source: Survival 500 data")+
19+
geom_smooth(mapping=aes(group=NA, x=DIASBP,y=SYSBP))+
20+
theme(panel.spacing = unit(0.5,"cm",data=NULL),
21+
strip.text.x=element_text(size=12, color="blue",face="bold.italic"),
22+
strip.text.y=element_text(size=12, color="blue",face="bold"),
23+
plot.title=element_text(face="italic", color="Blue"),
24+
panel.grid.minor=element_line(linetype="solid",color="black"),
25+
plot.background=element_rect(fill="lightblue",color="black")
26+
)
27+
28+
29+
ggplot2::ggsave(filename="images/pubgraph1-dot4.jpg",
30+
plot=pubgraph1,
31+
device="jpg",
32+
dpi = 72,
33+
width=450,
34+
height=400,
35+
units = "px")

data/dotJA1.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# JOUNRAL A UPDATE
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1<-
12+
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP)) +
13+
geom_point() +
14+
facet_grid(rows = vars(CVD_C), cols = vars(GENDER_C)) +
15+
labs(title="Diastolic and Systolic Blood Pressure by Gender and Cardiovascular Disease Status",
16+
x="Systolic Blood Pressure",
17+
y="Diastolic Blood Pressure",
18+
caption="Data source: Survival 500 data") +
19+
theme_bw()
20+
21+
ggplot2::ggsave(filename="images/pubgraph1-dotJA1.jpg",
22+
plot=pubgraph1,
23+
device="jpg",
24+
dpi = 72,
25+
width=450,
26+
height=400,
27+
units = "px")

data/dotJA2.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# JOUNRAL A UPDATE
2+
library(tidyverse)
3+
4+
surv<-read.csv("data/whas500.csv")%>%
5+
mutate(LENFOLY = round(LENFOL/365.25, 2), ## change follow-up days to years for better visualization
6+
AFB_C = ifelse(AFB==1, "Active", "Non-Active"),
7+
GENDER_C = ifelse(GENDER==1, "Male", "Female"),
8+
CVD_C = ifelse(CVD==1, "Yes", "No"))
9+
10+
11+
pubgraph1<-
12+
ggplot(data = surv, mapping = aes(x =SYSBP , y =DIASBP)) +
13+
geom_point() +
14+
facet_grid(rows = vars(CVD_C), cols = vars(GENDER_C)) +
15+
labs(title="Diastolic and Systolic Blood Pressure\nBy Gender and Cardiovascular Disease Status",
16+
x="Systolic Blood Pressure",
17+
y="Diastolic Blood Pressure",
18+
caption="Data source: Survival 500 data") +
19+
theme_bw()
20+
21+
ggplot2::ggsave(filename="images/pubgraph1-dotJA2.jpg",
22+
plot=pubgraph1,
23+
device="jpg",
24+
dpi = 72,
25+
width=450,
26+
height=400,
27+
units = "px")

0 commit comments

Comments
 (0)