fssdlyl001 发表于 2015-3-22 17:25 
这没有问题,可以用
执行这个语句:
library(ggplot2)
OR<-c(.508, .734, .418, .674, .610, .694, .567, .214)
lower<-c(.340, .587, .275, .363, .475, .386, .348, .031)
upper<-c(.759, .919, .636, 1.252, .784, 1.248, .925, 1.478)
type<-c(1,1)
odds<-data.frame(OR, lower, upper,type)
vars<-c("Hypertension(+)","Hypertension(-)","obesity(+)","obesity(-)", "Dyslipidemia(+)","Dyslipidemia(-)","central obesity(+)","central obesity(-)")
ticks<-c(seq(.1, 1, by =.1), seq(0, 10, by =1), seq(10, 100, by =10))
a1<-ggplot(odds, aes(y= OR, x = vars)) +scale_y_log10()
a3<-a2+geom_errorbar(aes(ymin=lower, ymax=upper), width=.1,lwd=1)
a4<-a3+geom_hline(yintercept = 1, linetype=2)
a5<-a4+coord_flip()+ facet_wrap(~type,nrow=2)
a6<-a5+labs(title = "", x = "", y = "Odds ratio for DM")
a7<-a6+theme_bw()
提示: Error: object 'a2' not found