forked from HeatherARobinson/CHAMP-data-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCHAMP literature review figure 2- cohort specific BMI curves
More file actions
82 lines (59 loc) · 3.85 KB
/
CHAMP literature review figure 2- cohort specific BMI curves
File metadata and controls
82 lines (59 loc) · 3.85 KB
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
setwd("c:/Users/mqbpjhr4/Documents")
data<-read.table("MedBMIlitreview2.csv",header=T,sep=",")
boys<-data[data$gender=="m",]
girls<-data[data$gender=="f",]
library(ggplot2)
#FOR MEDIANS
scaleFUN <- function(x) sprintf("%.0f", x)
g<-ggplot(girls, aes(x=age, y=bmi, colour=study, shape=study,linetype=as.factor(lt))) + geom_line(size=1.05)+
labs(x="Age (yrs)",y="Median BMI")+
theme_bw()+
scale_x_continuous(breaks = seq(4, 12, 1), limits =c(4,12))+
scale_y_continuous(breaks = seq(14, 20.5, 0.25),limits = c(14, 20.5))+
theme(legend.title=element_blank())+
theme(legend.text = element_text(size=8),axis.text=element_text(size=10),
axis.title=element_text(size=10))
b<-ggplot(boys, aes(x=age, y=bmi, colour=study, shape=study,linetype=as.factor(lt))) + geom_line(size=1.05)+
labs(x="Age (yrs)",y="Median BMI")+theme_bw()+scale_x_continuous(breaks = seq(4, 12, 1), limits =c(4,12))+
scale_y_continuous(breaks = seq(14, 20.5, 0.25),limits = c(14, 20.5))+
theme(legend.title=element_blank())+
theme(legend.text = element_text(size=8),axis.text=element_text(size=10),
axis.title=element_text(size=10))
c<-g+scale_shape_manual(values = c(3,0, 1,2,3,4,5, 6, 8,15,17,19,21,10,2,8,0,0,5,5,8))+
scale_colour_manual(values=c("blue3","red","blue3","blue3","goldenrod","forestgreen","forestgreen","blue3",
"blue3","blue3","goldenrod","goldenrod","blue3","forestgreen","red","red","blue3","goldenrod","goldenrod","blue3","goldenrod"))+
ggtitle("Median BMI by age and study population, girls")+geom_point(aes(x=age, y=bmi, colour=study))
d<-b+scale_shape_manual(values = c(3,0, 1,2,3,4,5, 6, 8,15,17,19,21,10,2,8,0,0,5,5,8))+
scale_colour_manual(values=c("blue3","red","blue3","blue3","goldenrod","forestgreen","forestgreen","blue3",
"blue3","blue3","goldenrod","goldenrod","blue3","forestgreen","red","red","blue3","goldenrod","goldenrod","blue3","goldenrod"))+
ggtitle("Median BMI by age and study population, boys")+geom_point(aes(x=age, y=bmi, colour=study))
d
library(gridExtra)
grid.arrange(c,d, ncol=2)
#######################################################
#FOR MEANS:
setwd("c:/Users/mqbpjhr4/Documents")
data<-read.table("MeanBMIlitreview.csv",header=T,sep=",")
boys<-data[data$gender=="m",]
girls<-data[data$gender=="f",]
library(ggplot2)
e<-ggplot(girls, aes(x=age, y=bmi, colour=study, shape=study,linetype=as.factor(lt))) + geom_line(size=1.05)+
labs(x="Age (yrs)",y="Mean BMI")+theme_bw()+scale_x_continuous(breaks = seq(4, 12, 1), limits =c(4,12))+
scale_y_continuous(breaks = seq(13.4, 27, 0.4),limits = c(13.4, 27))+ theme(legend.title=element_blank())+
ggtitle("Mean BMI by age and study population, girls")
f<-ggplot(boys, aes(x=age, y=bmi, colour=study, shape=study,linetype=as.factor(lt))) + geom_line(size=1.05)+
labs(x="Age (yrs)",y="Mean BMI")+theme_bw()+scale_x_continuous(breaks = seq(4, 12, 1), limits =c(4,12))+
scale_y_continuous(breaks = seq(13.4, 27, 0.4),limits = c(13.4, 27))+ theme(legend.title=element_blank())+
ggtitle("Mean BMI by age and study population, boys")
l<-e+scale_shape_manual(values = c(0,8,11,8,2,3,4,5, 0, 8,15,17,19,21,10,2, 18,0,1,3,1,15,25,8,1,1))+
scale_colour_manual(values=c("forestgreen","blue3","blue3","blue3","red","blue3","blue3","blue3","blue3","goldenrod","blue3","goldenrod","black",
"black","blue3","blue3","blue3","blue3","blue3","blue3","forestgreen","blue3","blue3","forestgreen","red"))+
geom_point(aes(x=age, y=bmi, colour=study, shape=study))
l
m<-f+scale_shape_manual(values = c(0,8,11,8,2,3,4,5, 0, 8,15,17,19,21,10,2, 18,0,1,3,1,15,25,8,1,1))+
scale_colour_manual(values=c("forestgreen","blue3","blue3","blue3","red","blue3","blue3","blue3","blue3","goldenrod","blue3","goldenrod","black",
"black","blue3","blue3","blue3","blue3","blue3","blue3","forestgreen","blue3","blue3","forestgreen","red"))+
geom_point(aes(x=age, y=bmi, colour=study, shape=study))
m
#library(gridExtra)
#grid.arrange(l,m, ncol=2)