##d3.1
library(readxl)
d3.1 <- read_excel('D:/QQ/1229092178/FileRecv/mvstats5.xlsx','d3.1')
d3.1=as.data.frame(d3.1)
rownames(d3.1) = as.matrix(d3.1[,1])
d3.1 <- d3.1[,-1]
head(d3.1)
## 食品 衣着 设备 医疗 交通 教育 居住 杂项
## 北京 4934.05 1512.88 981.13 1294.07 2328.51 2383.96 1246.19 649.66
## 天津 4249.31 1024.15 760.56 1163.98 1309.94 1639.83 1417.45 463.64
## 河北 2789.85 975.94 546.75 833.51 1010.51 895.06 917.19 266.16
## 山西 2600.37 1064.61 477.74 640.22 1027.99 1054.05 991.77 245.07
## 内蒙古 2824.89 1396.86 561.71 719.13 1123.82 1245.09 941.79 468.17
## 辽宁 3560.21 1017.65 439.28 879.08 1033.36 1052.94 1047.04 400.16
barplot(apply(d3.1,1,mean),las=0,col=1:3)
barplot(apply(d3.1,2,mean),las=3,col=1:4)
barplot(apply(d3.1,2,median),col=1:8)
boxplot(d3.1,horizontal=T,las=1)
#星状图
stars(d3.1,key.loc=c(13,1.5))
stars(d3.1,full=F,draw.segments=T,key.loc=c(13,1.7))
#脸谱图
library(aplpack)
faces(d3.1, ncol.plot=7)
## effect of variables:
## modified item Var
## "height of face " "食品"
## "width of face " "衣着"
## "structure of face" "设备"
## "height of mouth " "医疗"
## "width of mouth " "交通"
## "smiling " "教育"
## "height of eyes " "居住"
## "width of eyes " "杂项"
## "height of hair " "食品"
## "width of hair " "衣着"
## "style of hair " "设备"
## "height of nose " "医疗"
## "width of nose " "交通"
## "width of ear " "教育"
## "height of ear " "居住"
faces(d3.1[,2:8],ncol.plot=7)
## effect of variables:
## modified item Var
## "height of face " "衣着"
## "width of face " "设备"
## "structure of face" "医疗"
## "height of mouth " "交通"
## "width of mouth " "教育"
## "smiling " "居住"
## "height of eyes " "杂项"
## "width of eyes " "衣着"
## "height of hair " "设备"
## "width of hair " "医疗"
## "style of hair " "交通"
## "height of nose " "教育"
## "width of nose " "居住"
## "width of ear " "杂项"
## "height of ear " "衣着"
faces(d3.1[c(1,9,19,28,29,30),])
## effect of variables:
## modified item Var
## "height of face " "食品"
## "width of face " "衣着"
## "structure of face" "设备"
## "height of mouth " "医疗"
## "width of mouth " "交通"
## "smiling " "教育"
## "height of eyes " "居住"
## "width of eyes " "杂项"
## "height of hair " "食品"
## "width of hair " "衣着"
## "style of hair " "设备"
## "height of nose " "医疗"
## "width of nose " "交通"
## "width of ear " "教育"
## "height of ear " "居住"
library("TeachingDemos")
##
## 载入程辑包:'TeachingDemos'
## The following objects are masked from 'package:aplpack':
##
## faces, slider
faces2(d3.1,ncols=7)
library(MSG)
andrews_curve(d3.1[c(1,9,19,28,29,30),])
##城市现代化水平的直观分析
Case3=read_excel('D:/QQ/1229092178/FileRecv/mvcase5.xlsx','Case3');head(Case3)
## # A tibble: 6 × 11
## 地区 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 广州 57491 59.5 76829. 91.5 715. 8.77 13.2 187. 388. 93.7
## 2 深圳 60801 46.6 177507. 100 4348. 8.79 103. 274. 639. 96.8
## 3 珠海 45284 43.5 53669. 87.9 993. 18.6 13.2 42.4 197. 96.7
## 4 汕头 13284 42.2 15068. 72.3 320. 4.77 0.938 50.4 103. 96.6
## 5 佛山 41266 36.4 66542. 78.4 206. 3.09 4.55 60.7 210. 96.1
## 6 韶关 21124 44.4 20125. 49.8 51.3 1.11 2.43 23.2 226. 80
Case3=as.data.frame(Case3)
rownames(Case3) = as.matrix(Case3[,1])
Case3 <- Case3[,-1]
head(Case3)
## X1 X2 X3 X4 X5 X6 X7 X8
## 广州 57491 59.5390 76828.83 91.51 714.911 8.7661 13.17068 187.3963
## 深圳 60801 46.6122 177506.73 100.00 4347.830 8.7913 102.83076 274.0615
## 珠海 45284 43.5373 53668.53 87.90 993.304 18.5633 13.15848 42.4107
## 汕头 13284 42.2196 15068.48 72.34 319.595 4.7689 0.93792 50.4039
## 佛山 41266 36.4228 66541.98 78.39 205.935 3.0878 4.55315 60.6522
## 韶关 21124 44.4195 20124.57 49.76 51.320 1.1052 2.42531 23.1507
## X9 X10
## 广州 388.1707 93.7
## 深圳 638.6522 96.8
## 珠海 196.5402 96.7
## 汕头 103.1505 96.6
## 佛山 210.1388 96.1
## 韶关 225.5540 80.0
boxplot(Case3)
cm=apply(Case3,2,mean);cm
## X1 X2 X3 X4 X5 X6
## 27460.333333 42.672629 39320.453810 57.031429 729.019733 3.680486
## X7 X8 X9 X10
## 8.738092 78.016414 238.694271 84.380952
barplot(cm,horiz=T)
stars(Case3,key.loc=c(8,2))
stars(Case3,draw.segments=T,key.loc=c(8,2))
library(aplpack)
faces(Case3)
library(MSG)
andrews_curve(Case3)