#讀取資料,命名為"x"
x<- read.csv("strays.csv", stringsAsFactors = TRUE)
#查看資料結構
summary(x)
##        id         type      gender      size        color        age     
##  Min.   : 26250   狗:1048   F:534   BIG   :181   咖啡色: 13   ADULT:886  
##  1st Qu.: 50182   貓:  34   M:548   MEDIUM:713   白色  : 26   CHILD:196  
##  Median :129335                     SMALL :188   花色  : 88              
##  Mean   :120020                                  虎斑色:104              
##  3rd Qu.:179406                                  黃色  :249              
##  Max.   :248935                                  黑色  :602              
##                                                                          
##      county   
##  新北市 :220  
##  南投縣 :188  
##  高雄市 :172  
##  臺南市 : 97  
##  臺北市 : 84  
##  桃園市 : 74  
##  (Other):247
#重新命名欄位名稱
colnames(x) #檢視欄位名稱
## [1] "id"     "type"   "gender" "size"   "color"  "age"    "county"
colnames(x) <- c("id", "type", "gender", "size", "color","age","country")     

###類別資料分析###

#問題:犬與貓毛色分析的量長條圖
#次數分配表
t <- table(x$type,x$color)
t
##     
##      咖啡色 白色 花色 虎斑色 黃色 黑色
##   狗     13   26   75     93  246  595
##   貓      0    0   13     11    3    7
barplot(t)

barplot(t, beside =T )

#加上圖例與上色
rownames(t)
## [1] "狗" "貓"
label <- rownames(t)
label
## [1] "狗" "貓"
barplot(t,
        beside =T , 
        legend.text =label,
        xlab = "size",
        main = "犬與貓毛色分析的長條圖",
        sub = "by Yong-Sheng",
        col =c(39,11))

#問題:各縣市流浪動物數量長條圖
#次數分配表
table(x$type)
## 
##   狗   貓 
## 1048   34
table(x$country)
## 
## 南投縣 嘉義市 嘉義縣 基隆市 宜蘭縣 屏東縣 彰化縣 新北市 新竹市 新竹縣 桃園市 
##    188      2      1     15      3     40      4    220     63      6     74 
## 澎湖縣 臺中市 臺北市 臺南市 臺東縣 花蓮縣 苗栗縣 金門縣 雲林縣 高雄市 
##     15     11     84     97      3      2      3     49     30    172
k <-table(x$type,x$country)

k.t <- prop.table(k,2)
k.t
##     
##           南投縣      嘉義市      嘉義縣      基隆市      宜蘭縣      屏東縣
##   狗 0.984042553 1.000000000 1.000000000 0.933333333 1.000000000 1.000000000
##   貓 0.015957447 0.000000000 0.000000000 0.066666667 0.000000000 0.000000000
##     
##           彰化縣      新北市      新竹市      新竹縣      桃園市      澎湖縣
##   狗 1.000000000 1.000000000 1.000000000 1.000000000 0.959459459 1.000000000
##   貓 0.000000000 0.000000000 0.000000000 0.000000000 0.040540541 0.000000000
##     
##           臺中市      臺北市      臺南市      臺東縣      花蓮縣      苗栗縣
##   狗 0.909090909 0.845238095 0.948453608 1.000000000 1.000000000 1.000000000
##   貓 0.090909091 0.154761905 0.051546392 0.000000000 0.000000000 0.000000000
##     
##           金門縣      雲林縣      高雄市
##   狗 1.000000000 0.766666667 0.994186047
##   貓 0.000000000 0.233333333 0.005813953
#將次數變成百分比(乘以100)
k.t <- k.t*100
k.t
##     
##           南投縣      嘉義市      嘉義縣      基隆市      宜蘭縣      屏東縣
##   狗  98.4042553 100.0000000 100.0000000  93.3333333 100.0000000 100.0000000
##   貓   1.5957447   0.0000000   0.0000000   6.6666667   0.0000000   0.0000000
##     
##           彰化縣      新北市      新竹市      新竹縣      桃園市      澎湖縣
##   狗 100.0000000 100.0000000 100.0000000 100.0000000  95.9459459 100.0000000
##   貓   0.0000000   0.0000000   0.0000000   0.0000000   4.0540541   0.0000000
##     
##           臺中市      臺北市      臺南市      臺東縣      花蓮縣      苗栗縣
##   狗  90.9090909  84.5238095  94.8453608 100.0000000 100.0000000 100.0000000
##   貓   9.0909091  15.4761905   5.1546392   0.0000000   0.0000000   0.0000000
##     
##           金門縣      雲林縣      高雄市
##   狗 100.0000000  76.6666667  99.4186047
##   貓   0.0000000  23.3333333   0.5813953
#四捨五入至小數2位
k.t <- round(k.t,2)
k.t
##     
##      南投縣 嘉義市 嘉義縣 基隆市 宜蘭縣 屏東縣 彰化縣 新北市 新竹市 新竹縣
##   狗  98.40 100.00 100.00  93.33 100.00 100.00 100.00 100.00 100.00 100.00
##   貓   1.60   0.00   0.00   6.67   0.00   0.00   0.00   0.00   0.00   0.00
##     
##      桃園市 澎湖縣 臺中市 臺北市 臺南市 臺東縣 花蓮縣 苗栗縣 金門縣 雲林縣
##   狗  95.95 100.00  90.91  84.52  94.85 100.00 100.00 100.00 100.00  76.67
##   貓   4.05   0.00   9.09  15.48   5.15   0.00   0.00   0.00   0.00  23.33
##     
##      高雄市
##   狗  99.42
##   貓   0.58
barplot(k)

barplot(k, beside =T )

#加上圖例與上色
rownames(k)
## [1] "狗" "貓"
label <- rownames(k)
label
## [1] "狗" "貓"
barplot(k,
        beside =T , 
        legend.text =label,
        xlab = "縣市",
        main = "各縣市流浪動物數量長條圖",
        sub = "by Yong-Sheng",
        col =c(31,14))

#三、犬與貓毛色分析的圓餅圖

r <-table(x$type,x$color)
r
##     
##      咖啡色 白色 花色 虎斑色 黃色 黑色
##   狗     13   26   75     93  246  595
##   貓      0    0   13     11    3    7
r.t <-prop.table(r)
#將次數變成百分比(乘以100)
r.t <- r.t*100
r.t
##     
##          咖啡色       白色       花色     虎斑色       黃色       黑色
##   狗  1.2014787  2.4029575  6.9316081  8.5951941 22.7356747 54.9907579
##   貓  0.0000000  0.0000000  1.2014787  1.0166359  0.2772643  0.6469501
#四捨五入至小數2位
r.t <- round(r.t,2)
r.t
##     
##      咖啡色  白色  花色 虎斑色  黃色  黑色
##   狗   1.20  2.40  6.93   8.60 22.74 54.99
##   貓   0.00  0.00  1.20   1.02  0.28  0.65
o <- r.t[1,] # 狗資料
z <- r.t[2,] # 貓資料
o
## 咖啡色   白色   花色 虎斑色   黃色   黑色 
##   1.20   2.40   6.93   8.60  22.74  54.99
z
## 咖啡色   白色   花色 虎斑色   黃色   黑色 
##   0.00   0.00   1.20   1.02   0.28   0.65
# par()是圖形控制函數,mfrow = c(1,2)表示建立一個1x2的空間,用來呈現後續的圖
par(mfrow  = c(1,2))
pie(o, main = "Dog"  )
pie(z, main = "Cat"  )

dev.off()  #離開par()
## null device 
##           1
#畫圓餅圖並加上資料標籤
pie_category <- colnames(r.t)
pie_category
## [1] "咖啡色" "白色"   "花色"   "虎斑色" "黃色"   "黑色"
o_label <- paste(pie_category, o,"%", sep = "")
o_label
## [1] "咖啡色1.2%" "白色2.4%"   "花色6.93%"  "虎斑色8.6%" "黃色22.74%"
## [6] "黑色54.99%"
z_label <- paste(pie_category, z,"%", sep = "")
z_label
## [1] "咖啡色0%"    "白色0%"      "花色1.2%"    "虎斑色1.02%" "黃色0.28%"  
## [6] "黑色0.65%"
par(mfrow  = c(1,2))# c(1,2),表示建立一個1x2的空間,用來呈現後續的圖
pie(o, labels =o_label , main = "Dog")
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <e5>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <92>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <96>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <e5>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <95>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <a1>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '咖啡色1.2%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+5496
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+5561
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <e7>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <99>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <bd>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色2.4%' in 'mbcsToSbcs': dot substituted
## for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+767d
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <8a>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <b1>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '花色6.93%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+82b1
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <99>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <8e>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <e6>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <96>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <91>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色8.6%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+864e
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+6591
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <e9>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <bb>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <83>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色22.74%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+9ec3
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <e9>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <bb>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <91>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色54.99%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+9ed1
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
pie(z, labels =z_label , main = "Cat")
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <e5>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <92>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <96>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <e5>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <95>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <a1>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '咖啡色0%' in 'mbcsToSbcs': dot substituted
## for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+5496
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+5561
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <e7>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <99>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <bd>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '白色0%' in 'mbcsToSbcs': dot substituted
## for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+767d
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <8a>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <b1>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : conversion failure on '花色1.2%' in 'mbcsToSbcs': dot substituted
## for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+82b1
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <99>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <8e>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <e6>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <96>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <91>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '虎斑色1.02%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+864e
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+6591
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <e9>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <bb>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <83>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黃色0.28%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+9ec3
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <e9>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <bb>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <91>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <e8>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <89>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj
## = ifelse(P$x < : conversion failure on '黑色0.65%' in 'mbcsToSbcs': dot
## substituted for <b2>
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+9ed1
## Warning in text.default(1.1 * P$x, 1.1 * P$y, labels[i], xpd = TRUE, adj =
## ifelse(P$x < : font metrics unknown for Unicode character U+8272
dev.off() 
## null device 
##           1