微信公众号:医学统计与R语言
如果你觉得对你有帮助,欢迎转发
百分条图-输入1:
library(ggplot2)
结果1:
year
输入2:
percentbar<-gather(percentbar,key=subject,value=TEH,-year)percentbar$subject<-factor(percentbar$subject,levels=c("Individual","society","government"))ggplot(percentbar,aes(x=year,y=TEH,fill=subject))+geom_bar(stat="identity")+geom_text(aes(label=paste(TEH,"%")),size=5,col="white",position=position_stack(vjust=0.5))+theme_stata()+theme(legend.position="bottom",legend.text=element_text(face="bold",size=12),legend.title=element_blank())+scale_x_continuous(breaks=seq(,,1))+scale_y_continuous(labels=paste(c(0,25,50,75,100),'%'))+labs(x="Year",y="TotalExpenditureonHealth")+theme(axis.text=element_text(face="bold",size=12),axis.title=element_text(face="bold",size=14))+theme(axis.line=element_line(size=1.2,colour="black"),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.border=element_blank(),panel.background=element_blank())+scale_fill_lancet()
结果2:
雷达图-输入3:
"radar.xlsx")
结果3:
1每千人执业(助理)医师数3.332.902.442.59 2每千人注册护士数3.513.232.952.94 3每千人口床位数5.796.104.566.03 4卫生总费用占GDP比例(%)5.464.305.156.36 5居民年平均就诊次数10.947.387.455.96 6年住院率(%)17.8018.0015.1018.30指标浙江江苏广东全国
输入4:
"radarchart")
结果4:
输入5:
library(fmsb) radar1<-as.data.frame(t(radar[,-1]));radar1colnames(radar1)<-radar$指标radar2<-rbind(c(4,4,7,7,11,20),rep(0,6),radar1);radar2library(RColorBrewer)colors_border<-brewer.pal(4,"Dark2")library(scales)colors_in<-alpha(colors_border,0.1)radarchart(radar2,axistype=2,seg=5,pty=2,plty=2,plwd=2,cglty=1,cglwd=1,cglcol="gray",axislabcol="blue",centerzero=T,vlcex=1.3,pcol=colors_border,pfcol=colors_in)legend(x=1.2,y=1.4,legend=rownames(radar2[-c(1,2),]),bty="n",pch=2,col=colors_border,text.col="black",cex=1.5,pt.cex=1.5)install.packages("fmsb")
结果5:
The data frame to be used to draw radarchart. If maxmin is TRUE, this must include maximum values as row 1 and minimum values as row 2 for each variables, and actual data should be given as row 3 and lower rows. The number of columns (variables) must be more than 2.
前文链接:
医学统计与R语言:多列分组正态性检验
医学统计与R语言:Logistic Distribution
医学统计与R语言:超几何分布(Hypergeometric distribution)与Fisher精确检验
医学统计与R语言:四格表卡方还需要连续校正吗?
医学统计与R语言:这个Calibration plot有点色!
医学统计与R语言:样本方差的抽样分布
医学统计与R语言:标准Z值一定服从标准正态分布?
医学统计与R语言:对数正态分布与卡方分布
医学统计与R语言:qvalue
医学统计与R语言:Meta 回归作图(Meta regression Plot)
医学统计与R语言:aggregate.plot了解一下
医学统计与R语言:有序Probit回归(Ordered Probit Model)
医学统计与R语言:Probit回归模型及边际效应(Marginal effects)
医学统计与R语言:Lord’s Paradox
医学统计与R语言:协方差分析(ANCOVA)+plus
医学统计与R语言:Kendall是谁?样本量是自变量的10倍?
医学统计与R语言:方差分析中计划好的多重比较(Planned Comparisons and Post Hoc Tests)
医学统计与R语言:圆形树状图(circular dendrogram)
医学统计与R语言:画一个姑娘陪着我,再画个花边的被窝
医学统计与R语言:双因素重复测量方差分析(Two-way repeated measures ANOVA)
医学统计R语言:分面画boxplot
医学统计与R语言:调节效应分析(Moderation Analysis)
医学统计与R语言:结构方程模型(structural equation model)
医学统计与R语言:中介效应分析(mediation effect analysis)
医学统计与R语言:生存曲线(survival curves)with risk.table
医学统计与R语言:如何比较两种诊断试验的灵敏度和特异度?
医学统计与R语言:你知道nomogram的points和total points怎么算吗?
医学统计与R语言:Cleveland dot plot
医学统计与R语言:交互作用模型中分组效应及标准误的计算
医学统计与R语言:多条ROC曲线的AUC多重比较
医学统计与R语言:来,今天学个散点图!
医学统计与R语言:一份简单的数据整理分析
医学统计与R语言:利用金字塔图比较多个指标
医学统计与R语言:点图(dotplot)
医学统计与R语言:幕后高手出马!
医学统计与R语言:Calibration plot with 置信区间
医学统计与R语言:还说自己不会画Calibration plot!
医学统计与R语言:KS曲线,KS plot,lift plot
医学统计与R语言:身体酸痛,醒来学个卡方检验
医学统计与R语言:利用午睡几分钟,学习下Population Pyramid
医学统计与R语言:有序Logistic回归平行线检验(Test proportional odds assumption )
医学统计与R语言:你的基金标书里还少这幅图!
医学统计与R语言:这里的坑你踩过几回,有序多分类Logistic回归(Ordinal Logistic Regression)
医学统计与R语言:logsitc回归校准曲线 Calibration curve
医学统计与R语言:多分格相关系数(polychoric)多序列相关系数(polyserial)Coefficient Omega
医学统计与R语言:Tobit回归中的Marginal effect
医学统计与R语言:定量变量的无监督离散化( unsupervised discretization)
医学统计与R语言:Welch's ANOVA and Games-Howell post-hoc test
医学统计与R语言:配对均值检验可视化加label
医学统计与R语言:线性固定效应模型(Linear fix effect model )
医学统计与R语言:Tobit回归模型
函数医学统计与R语言:随机森林与Logistic预测(randomForest vs Logistic regression)
医学统计与R语言:多重比较P值的可视化
医学统计与R语言:肿瘤研究中的waterfall plot(瀑布图)
医学统计与R语言:多元方差分析与非参数多元方差分析
医学统计与R语言:使用R语言实现Johnson-Neyman分析
医学统计与R语言:多层线性模型图示
医学统计与R语言:多层线性模型(混合线性模型
医学统计与R语言:best subset of inputs for the glm famil
医学统计与R语言:多重线回归自变量筛选的几种方法
医学统计与R语言:关联规则Apriori算
医学统计与R语言:列联表可视化的4种方
医学统计与R语言:盘它!什么格式文件都可
医学统计与R语言:离群值分析(Outlier Detection
医学统计与R语言:决策树CHAI
医学统计与R语言:主成分分析(PCA)及可视
医学统计与R语言:可能是最全R语言操作手册(cheatsheets)
医学统计与R语言:听说你还在手动画三线表!
医学统计与R语言:合并多个Excel文
医学统计与R语言:政策效果评价之合成控制
医学统计与R语言:线性回归模型假设条件验证与诊断
医学统计与R语言:想发表sci就画这种Bland-Altman Plot