National Survey on Reading

Data

setwd("~/Dropbox/Works/Class/Case_studies_in_stat/R.WD/sejong")
load("reading.rda")
options(width=132)
reading.rate
##    year size  all    m    f  20s  30s  40s  50s 60.over under.middle high.school college metro medium small
## 1  1995 1200 79.0 81.7 76.3 94.9 84.6 77.6 53.4      NA         44.8        85.5    95.8  84.3   84.1  61.8
## 2  1996 1200 77.2 79.6 74.8 93.9 87.1 71.6 53.7      NA         43.8        82.0    95.0  80.2   82.5  62.9
## 3  1999 1500 77.8 77.1 78.5 91.2 86.4 74.3 49.5      NA         36.4        79.9    93.4  82.0   80.1  64.9
## 4  2002 1200 72.0 70.0 74.0 85.9 79.8 74.1 39.1      NA         25.2        69.3    88.5  76.6   72.7  60.2
## 5  2004 1000 76.3 74.0 78.6 92.2 82.9 78.1 43.0      NA         30.2        75.2    90.5  80.1   76.7  66.7
## 6  2006 1000 75.9 78.6 73.1 88.6 87.0 74.7 53.0      NA         31.0        67.0    93.7  75.1   78.9  66.3
## 7  2007 1000 76.7 76.8 76.6 86.3 84.2 79.0 57.5      NA         27.0        71.9    88.1  76.7   77.2  74.2
## 8  2008 1000 72.2 67.8 76.7 81.1 76.6 77.5 56.0      NA         34.8        62.3    87.4  71.0   74.0  70.5
## 9  2009 1000 71.7 73.2 70.2 85.7 82.0 74.2 55.9    36.4         26.8        64.7    89.4  71.0   74.0  64.8
## 10 2010 1000 65.4 63.0 67.9 82.9 72.3 64.6 55.4    34.8         29.1        51.0    86.0  67.8   67.5  41.2
str(reading.rate)
## 'data.frame':    10 obs. of  16 variables:
##  $ year        : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010
##  $ size        : int  1200 1200 1500 1200 1000 1000 1000 1000 1000 1000
##  $ all         : num  79 77.2 77.8 72 76.3 75.9 76.7 72.2 71.7 65.4
##  $ m           : num  81.7 79.6 77.1 70 74 78.6 76.8 67.8 73.2 63
##  $ f           : num  76.3 74.8 78.5 74 78.6 73.1 76.6 76.7 70.2 67.9
##  $ 20s         : num  94.9 93.9 91.2 85.9 92.2 88.6 86.3 81.1 85.7 82.9
##  $ 30s         : num  84.6 87.1 86.4 79.8 82.9 87 84.2 76.6 82 72.3
##  $ 40s         : num  77.6 71.6 74.3 74.1 78.1 74.7 79 77.5 74.2 64.6
##  $ 50s         : num  53.4 53.7 49.5 39.1 43 53 57.5 56 55.9 55.4
##  $ 60.over     : num  NA NA NA NA NA NA NA NA 36.4 34.8
##  $ under.middle: num  44.8 43.8 36.4 25.2 30.2 31 27 34.8 26.8 29.1
##  $ high.school : num  85.5 82 79.9 69.3 75.2 67 71.9 62.3 64.7 51
##  $ college     : num  95.8 95 93.4 88.5 90.5 93.7 88.1 87.4 89.4 86
##  $ metro       : num  84.3 80.2 82 76.6 80.1 75.1 76.7 71 71 67.8
##  $ medium      : num  84.1 82.5 80.1 72.7 76.7 78.9 77.2 74 74 67.5
##  $ small       : num  61.8 62.9 64.9 60.2 66.7 66.3 74.2 70.5 64.8 41.2
reading.quantity
##    year size  all    m    f  20s  30s  40s 50s 60.over under.middle high.school college metro medium small
## 1  1995 1200  9.6  9.9  9.3 13.1 11.2  7.7 4.7      NA          3.3         8.9    15.7  10.3   13.9  10.6
## 2  1996 1200  9.1 10.2  8.1 14.5  9.8  7.3 4.2      NA          2.3         9.2    14.5  10.7   10.0   4.4
## 3  1999 1500  9.3  9.6  8.9 13.0 10.5  7.6 3.5      NA          1.6         7.6    15.0  10.5    9.7   5.9
## 4  2002 1200 10.0 10.2  9.8 14.1 10.1 10.4 3.4      NA          1.3         8.2    14.5   9.9   11.8   7.9
## 5  2004 1000 11.0 10.4 11.7 16.9 10.2 10.3 3.8      NA          4.2         8.0    15.7  12.0   10.7   9.0
## 6  2006 1000 11.9 12.3 11.5 14.6 13.3 10.4 9.0      NA          2.4         7.9    17.3  10.3   13.9  10.6
## 7  2007 1000 12.1 12.8 11.4 14.4 14.4 12.3 7.4      NA          2.5         9.5    15.5  11.5   12.6  13.5
## 8  2008 1000 11.9 11.4 12.4 13.4 13.1 13.4 8.1      NA          4.8         8.0    16.5  11.4   12.9   9.1
## 9  2009 1000 10.9 12.6  9.3 19.4 11.1  9.0 5.5     4.6          2.9         8.2    15.3  10.7   12.0   6.9
## 10 2010 1000 10.8 10.3 11.4 16.1 12.0 11.0 6.2     5.4          2.5         6.4    16.5  12.0   10.6   5.7
str(reading.quantity)
## 'data.frame':    10 obs. of  16 variables:
##  $ year        : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010
##  $ size        : int  1200 1200 1500 1200 1000 1000 1000 1000 1000 1000
##  $ all         : num  9.6 9.1 9.3 10 11 11.9 12.1 11.9 10.9 10.8
##  $ m           : num  9.9 10.2 9.6 10.2 10.4 12.3 12.8 11.4 12.6 10.3
##  $ f           : num  9.3 8.1 8.9 9.8 11.7 11.5 11.4 12.4 9.3 11.4
##  $ 20s         : num  13.1 14.5 13 14.1 16.9 14.6 14.4 13.4 19.4 16.1
##  $ 30s         : num  11.2 9.8 10.5 10.1 10.2 13.3 14.4 13.1 11.1 12
##  $ 40s         : num  7.7 7.3 7.6 10.4 10.3 10.4 12.3 13.4 9 11
##  $ 50s         : num  4.7 4.2 3.5 3.4 3.8 9 7.4 8.1 5.5 6.2
##  $ 60.over     : num  NA NA NA NA NA NA NA NA 4.6 5.4
##  $ under.middle: num  3.3 2.3 1.6 1.3 4.2 2.4 2.5 4.8 2.9 2.5
##  $ high.school : num  8.9 9.2 7.6 8.2 8 7.9 9.5 8 8.2 6.4
##  $ college     : num  15.7 14.5 15 14.5 15.7 17.3 15.5 16.5 15.3 16.5
##  $ metro       : num  10.3 10.7 10.5 9.9 12 10.3 11.5 11.4 10.7 12
##  $ medium      : num  13.9 10 9.7 11.8 10.7 13.9 12.6 12.9 12 10.6
##  $ small       : num  10.6 4.4 5.9 7.9 9 10.6 13.5 9.1 6.9 5.7

독서율

reshape for ggplot

library(reshape2)
(reading.r.sex <- melt(reading.rate[c("year", "all", "m", "f")], idvars = "year", measure.vars=c("all", "m", "f"), variable.name = "gender", value.name = "rate"))
##    year gender rate
## 1  1995    all 79.0
## 2  1996    all 77.2
## 3  1999    all 77.8
## 4  2002    all 72.0
## 5  2004    all 76.3
## 6  2006    all 75.9
## 7  2007    all 76.7
## 8  2008    all 72.2
## 9  2009    all 71.7
## 10 2010    all 65.4
## 11 1995      m 81.7
## 12 1996      m 79.6
## 13 1999      m 77.1
## 14 2002      m 70.0
## 15 2004      m 74.0
## 16 2006      m 78.6
## 17 2007      m 76.8
## 18 2008      m 67.8
## 19 2009      m 73.2
## 20 2010      m 63.0
## 21 1995      f 76.3
## 22 1996      f 74.8
## 23 1999      f 78.5
## 24 2002      f 74.0
## 25 2004      f 78.6
## 26 2006      f 73.1
## 27 2007      f 76.6
## 28 2008      f 76.7
## 29 2009      f 70.2
## 30 2010      f 67.9
str(reading.r.sex)
## 'data.frame':    30 obs. of  3 variables:
##  $ year  : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ gender: Factor w/ 3 levels "all","m","f": 1 1 1 1 1 1 1 1 1 1 ...
##  $ rate  : num  79 77.2 77.8 72 76.3 75.9 76.7 72.2 71.7 65.4 ...
(reading.r.age <- melt(reading.rate[c("year", "20s", "30s", "40s", "50s", "60.over")], idvars = "year", measure.vars=c("20s", "30s", "40s", "50s", "60.over"), variable.name = "age", value.name = "rate"))
##    year     age rate
## 1  1995     20s 94.9
## 2  1996     20s 93.9
## 3  1999     20s 91.2
## 4  2002     20s 85.9
## 5  2004     20s 92.2
## 6  2006     20s 88.6
## 7  2007     20s 86.3
## 8  2008     20s 81.1
## 9  2009     20s 85.7
## 10 2010     20s 82.9
## 11 1995     30s 84.6
## 12 1996     30s 87.1
## 13 1999     30s 86.4
## 14 2002     30s 79.8
## 15 2004     30s 82.9
## 16 2006     30s 87.0
## 17 2007     30s 84.2
## 18 2008     30s 76.6
## 19 2009     30s 82.0
## 20 2010     30s 72.3
## 21 1995     40s 77.6
## 22 1996     40s 71.6
## 23 1999     40s 74.3
## 24 2002     40s 74.1
## 25 2004     40s 78.1
## 26 2006     40s 74.7
## 27 2007     40s 79.0
## 28 2008     40s 77.5
## 29 2009     40s 74.2
## 30 2010     40s 64.6
## 31 1995     50s 53.4
## 32 1996     50s 53.7
## 33 1999     50s 49.5
## 34 2002     50s 39.1
## 35 2004     50s 43.0
## 36 2006     50s 53.0
## 37 2007     50s 57.5
## 38 2008     50s 56.0
## 39 2009     50s 55.9
## 40 2010     50s 55.4
## 41 1995 60.over   NA
## 42 1996 60.over   NA
## 43 1999 60.over   NA
## 44 2002 60.over   NA
## 45 2004 60.over   NA
## 46 2006 60.over   NA
## 47 2007 60.over   NA
## 48 2008 60.over   NA
## 49 2009 60.over 36.4
## 50 2010 60.over 34.8
str(reading.r.age)
## 'data.frame':    50 obs. of  3 variables:
##  $ year: int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ age : Factor w/ 5 levels "20s","30s","40s",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ rate: num  94.9 93.9 91.2 85.9 92.2 88.6 86.3 81.1 85.7 82.9 ...
(reading.r.edu <- melt(reading.rate[c("year", "under.middle", "high.school", "college")], idvars = "year", measure.vars=c("under.middle", "high.school", "college"), variable.name = "education", value.name = "rate"))
##    year    education rate
## 1  1995 under.middle 44.8
## 2  1996 under.middle 43.8
## 3  1999 under.middle 36.4
## 4  2002 under.middle 25.2
## 5  2004 under.middle 30.2
## 6  2006 under.middle 31.0
## 7  2007 under.middle 27.0
## 8  2008 under.middle 34.8
## 9  2009 under.middle 26.8
## 10 2010 under.middle 29.1
## 11 1995  high.school 85.5
## 12 1996  high.school 82.0
## 13 1999  high.school 79.9
## 14 2002  high.school 69.3
## 15 2004  high.school 75.2
## 16 2006  high.school 67.0
## 17 2007  high.school 71.9
## 18 2008  high.school 62.3
## 19 2009  high.school 64.7
## 20 2010  high.school 51.0
## 21 1995      college 95.8
## 22 1996      college 95.0
## 23 1999      college 93.4
## 24 2002      college 88.5
## 25 2004      college 90.5
## 26 2006      college 93.7
## 27 2007      college 88.1
## 28 2008      college 87.4
## 29 2009      college 89.4
## 30 2010      college 86.0
str(reading.r.edu)
## 'data.frame':    30 obs. of  3 variables:
##  $ year     : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ education: Factor w/ 3 levels "under.middle",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ rate     : num  44.8 43.8 36.4 25.2 30.2 31 27 34.8 26.8 29.1 ...
(reading.r.res <- melt(reading.rate[c("year", "metro", "medium", "small")], idvars = "year", measure.vars=c("metro", "medium", "small"), variable.name = "residence", value.name = "rate"))
##    year residence rate
## 1  1995     metro 84.3
## 2  1996     metro 80.2
## 3  1999     metro 82.0
## 4  2002     metro 76.6
## 5  2004     metro 80.1
## 6  2006     metro 75.1
## 7  2007     metro 76.7
## 8  2008     metro 71.0
## 9  2009     metro 71.0
## 10 2010     metro 67.8
## 11 1995    medium 84.1
## 12 1996    medium 82.5
## 13 1999    medium 80.1
## 14 2002    medium 72.7
## 15 2004    medium 76.7
## 16 2006    medium 78.9
## 17 2007    medium 77.2
## 18 2008    medium 74.0
## 19 2009    medium 74.0
## 20 2010    medium 67.5
## 21 1995     small 61.8
## 22 1996     small 62.9
## 23 1999     small 64.9
## 24 2002     small 60.2
## 25 2004     small 66.7
## 26 2006     small 66.3
## 27 2007     small 74.2
## 28 2008     small 70.5
## 29 2009     small 64.8
## 30 2010     small 41.2
str(reading.r.res)
## 'data.frame':    30 obs. of  3 variables:
##  $ year     : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ residence: Factor w/ 3 levels "metro","medium",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ rate     : num  84.3 80.2 82 76.6 80.1 75.1 76.7 71 71 67.8 ...

성별

library(ggplot2)
source("../../R.WD/lifetable/theme_kr.R")
(r.sex1 <- ggplot(reading.r.sex, aes(x=year, y=rate, colour=gender)) + geom_point())

(r.sex2 <- r.sex1 + geom_line())

(r.sex3 <- r.sex2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서율(%)") + ggtitle("성별 독서율의 변화"))

(r.sex4 <- r.sex3 + labs(colour="성별") + scale_colour_discrete(labels=c("전체", "남자", "여자")))

(r.sex5 <- r.sex4 + scale_y_continuous(limits=c(60, 90)))

연령별

(r.age1 <- ggplot(reading.r.age, aes(x=year, y=rate, colour=age)) + geom_point())
## Warning: Removed 8 rows containing missing values (geom_point).

(r.age2 <- r.age1 + geom_line())
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(r.age3 <- r.age2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서율(%)") + ggtitle("연령별 독서율의 변화"))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(r.age4 <- r.age3 + labs(colour="연령별") + scale_colour_discrete(labels=c("20대", "30대", "40대", "50대", "60이상")))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(r.age5 <- r.age4 + scale_y_continuous(limits=c(25, 100)))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

교육수준별

(r.edu1 <- ggplot(reading.r.edu, aes(x=year, y=rate, colour=education)) + geom_point())

(r.edu2 <- r.edu1 + geom_line())

(r.edu3 <- r.edu2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서율(%)") + ggtitle("교육수준별 독서율의 변화"))

(r.edu4 <- r.edu3 + labs(colour="교육수준") + scale_colour_discrete(labels=c("중졸 이하", "고졸", "대학 이상")))

(r.edu5 <- r.edu4 + scale_y_continuous(limits=c(0, 100)))

거주지역별

(r.res1 <- ggplot(reading.r.res, aes(x=year, y=rate, colour=residence)) + geom_point())

(r.res2 <- r.res1 + geom_line())

(r.res3 <- r.res2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서율(%)") + ggtitle("거주지역별 독서율의 변화"))

(r.res4 <- r.res3 + labs(colour="거주지역") + scale_colour_discrete(labels=c("대도시", "중소도시", "읍면")))

(r.res5 <- r.res4 + scale_y_continuous(limits=c(0, 100)))

독서량

reshape for ggplot

(reading.q.sex <- melt(reading.quantity[c("year", "all", "m", "f")], idvars = "year", measure.vars=c("all", "m", "f"), variable.name = "gender", value.name = "quantity"))
##    year gender quantity
## 1  1995    all      9.6
## 2  1996    all      9.1
## 3  1999    all      9.3
## 4  2002    all     10.0
## 5  2004    all     11.0
## 6  2006    all     11.9
## 7  2007    all     12.1
## 8  2008    all     11.9
## 9  2009    all     10.9
## 10 2010    all     10.8
## 11 1995      m      9.9
## 12 1996      m     10.2
## 13 1999      m      9.6
## 14 2002      m     10.2
## 15 2004      m     10.4
## 16 2006      m     12.3
## 17 2007      m     12.8
## 18 2008      m     11.4
## 19 2009      m     12.6
## 20 2010      m     10.3
## 21 1995      f      9.3
## 22 1996      f      8.1
## 23 1999      f      8.9
## 24 2002      f      9.8
## 25 2004      f     11.7
## 26 2006      f     11.5
## 27 2007      f     11.4
## 28 2008      f     12.4
## 29 2009      f      9.3
## 30 2010      f     11.4
str(reading.q.sex)
## 'data.frame':    30 obs. of  3 variables:
##  $ year    : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ gender  : Factor w/ 3 levels "all","m","f": 1 1 1 1 1 1 1 1 1 1 ...
##  $ quantity: num  9.6 9.1 9.3 10 11 11.9 12.1 11.9 10.9 10.8 ...
(reading.q.age <- melt(reading.quantity[c("year", "20s", "30s", "40s", "50s", "60.over")], idvars = "year", measure.vars=c("20s", "30s", "40s", "50s", "60.over"), variable.name = "age", value.name = "quantity"))
##    year     age quantity
## 1  1995     20s     13.1
## 2  1996     20s     14.5
## 3  1999     20s     13.0
## 4  2002     20s     14.1
## 5  2004     20s     16.9
## 6  2006     20s     14.6
## 7  2007     20s     14.4
## 8  2008     20s     13.4
## 9  2009     20s     19.4
## 10 2010     20s     16.1
## 11 1995     30s     11.2
## 12 1996     30s      9.8
## 13 1999     30s     10.5
## 14 2002     30s     10.1
## 15 2004     30s     10.2
## 16 2006     30s     13.3
## 17 2007     30s     14.4
## 18 2008     30s     13.1
## 19 2009     30s     11.1
## 20 2010     30s     12.0
## 21 1995     40s      7.7
## 22 1996     40s      7.3
## 23 1999     40s      7.6
## 24 2002     40s     10.4
## 25 2004     40s     10.3
## 26 2006     40s     10.4
## 27 2007     40s     12.3
## 28 2008     40s     13.4
## 29 2009     40s      9.0
## 30 2010     40s     11.0
## 31 1995     50s      4.7
## 32 1996     50s      4.2
## 33 1999     50s      3.5
## 34 2002     50s      3.4
## 35 2004     50s      3.8
## 36 2006     50s      9.0
## 37 2007     50s      7.4
## 38 2008     50s      8.1
## 39 2009     50s      5.5
## 40 2010     50s      6.2
## 41 1995 60.over       NA
## 42 1996 60.over       NA
## 43 1999 60.over       NA
## 44 2002 60.over       NA
## 45 2004 60.over       NA
## 46 2006 60.over       NA
## 47 2007 60.over       NA
## 48 2008 60.over       NA
## 49 2009 60.over      4.6
## 50 2010 60.over      5.4
str(reading.q.age)
## 'data.frame':    50 obs. of  3 variables:
##  $ year    : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ age     : Factor w/ 5 levels "20s","30s","40s",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ quantity: num  13.1 14.5 13 14.1 16.9 14.6 14.4 13.4 19.4 16.1 ...
(reading.q.edu <- melt(reading.quantity[c("year", "under.middle", "high.school", "college")], idvars = "year", measure.vars=c("under.middle", "high.school", "college"), variable.name = "education", value.name = "quantity"))
##    year    education quantity
## 1  1995 under.middle      3.3
## 2  1996 under.middle      2.3
## 3  1999 under.middle      1.6
## 4  2002 under.middle      1.3
## 5  2004 under.middle      4.2
## 6  2006 under.middle      2.4
## 7  2007 under.middle      2.5
## 8  2008 under.middle      4.8
## 9  2009 under.middle      2.9
## 10 2010 under.middle      2.5
## 11 1995  high.school      8.9
## 12 1996  high.school      9.2
## 13 1999  high.school      7.6
## 14 2002  high.school      8.2
## 15 2004  high.school      8.0
## 16 2006  high.school      7.9
## 17 2007  high.school      9.5
## 18 2008  high.school      8.0
## 19 2009  high.school      8.2
## 20 2010  high.school      6.4
## 21 1995      college     15.7
## 22 1996      college     14.5
## 23 1999      college     15.0
## 24 2002      college     14.5
## 25 2004      college     15.7
## 26 2006      college     17.3
## 27 2007      college     15.5
## 28 2008      college     16.5
## 29 2009      college     15.3
## 30 2010      college     16.5
str(reading.q.edu)
## 'data.frame':    30 obs. of  3 variables:
##  $ year     : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ education: Factor w/ 3 levels "under.middle",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ quantity : num  3.3 2.3 1.6 1.3 4.2 2.4 2.5 4.8 2.9 2.5 ...
(reading.q.res <- melt(reading.quantity[c("year", "metro", "medium", "small")], idvars = "year", measure.vars=c("metro", "medium", "small"), variable.name = "residence", value.name = "quantity"))
##    year residence quantity
## 1  1995     metro     10.3
## 2  1996     metro     10.7
## 3  1999     metro     10.5
## 4  2002     metro      9.9
## 5  2004     metro     12.0
## 6  2006     metro     10.3
## 7  2007     metro     11.5
## 8  2008     metro     11.4
## 9  2009     metro     10.7
## 10 2010     metro     12.0
## 11 1995    medium     13.9
## 12 1996    medium     10.0
## 13 1999    medium      9.7
## 14 2002    medium     11.8
## 15 2004    medium     10.7
## 16 2006    medium     13.9
## 17 2007    medium     12.6
## 18 2008    medium     12.9
## 19 2009    medium     12.0
## 20 2010    medium     10.6
## 21 1995     small     10.6
## 22 1996     small      4.4
## 23 1999     small      5.9
## 24 2002     small      7.9
## 25 2004     small      9.0
## 26 2006     small     10.6
## 27 2007     small     13.5
## 28 2008     small      9.1
## 29 2009     small      6.9
## 30 2010     small      5.7
str(reading.q.res)
## 'data.frame':    30 obs. of  3 variables:
##  $ year     : int  1995 1996 1999 2002 2004 2006 2007 2008 2009 2010 ...
##  $ residence: Factor w/ 3 levels "metro","medium",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ quantity : num  10.3 10.7 10.5 9.9 12 10.3 11.5 11.4 10.7 12 ...

성별

(q.sex1 <- ggplot(reading.q.sex, aes(x=year, y=quantity, colour=gender)) + geom_point())

(q.sex2 <- q.sex1 + geom_line())

(q.sex3 <- q.sex2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서량(권)") + ggtitle("성별 독서량의 변화"))

(q.sex4 <- q.sex3 + labs(colour="성별") + scale_colour_discrete(labels=c("전체", "남자", "여자")))

(q.sex5 <- q.sex4 + scale_y_continuous(limits=c(0, 20)))

연령별

(q.age1 <- ggplot(reading.q.age, aes(x=year, y=quantity, colour=age)) + geom_point())
## Warning: Removed 8 rows containing missing values (geom_point).

(q.age2 <- q.age1 + geom_line())
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(q.age3 <- q.age2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서량(권)") + ggtitle("연령별 독서량의 변화"))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(q.age4 <- q.age3 + labs(colour="연령별") + scale_colour_discrete(labels=c("20대", "30대", "40대", "50대", "60이상")))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

(q.age5 <- q.age4 + scale_y_continuous(limits=c(0, 20)))
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 rows containing missing values (geom_path).

교육수준별

(q.edu1 <- ggplot(reading.q.edu, aes(x=year, y=quantity, colour=education)) + geom_point())

(q.edu2 <- q.edu1 + geom_line())

(q.edu3 <- q.edu2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서량(권)") + ggtitle("교육수준별 독서량의 변화"))

(q.edu4 <- q.edu3 + labs(colour="교육수준") + scale_colour_discrete(labels=c("중졸 이하", "고졸", "대학 이상")))

(q.edu5 <- q.edu4 + scale_y_continuous(limits=c(0, 20)))

거주지역별

(q.res1 <- ggplot(reading.q.res, aes(x=year, y=quantity, colour=residence)) + geom_point())

(q.res2 <- q.res1 + geom_line())

(q.res3 <- q.res2 + theme_bw() + theme.kr + xlab("연도") + ylab("독서량(권)") + ggtitle("거주지역별 독서량의 변화"))

(q.res4 <- q.res3 + labs(colour="거주지역") + scale_colour_discrete(labels=c("대도시", "중소도시", "읍면")))

(q.res5 <- q.res4 + scale_y_continuous(limits=c(0, 20)))

갈무리

save.image("reading_0922.rda")