<1.지역별 사교육 참여율 분석>
데이터 불러오기
df_participate <- read_excel("C:\\Users\\user\\Desktop\\final project\\지역별사교육참여율.xlsx")
df_participate
## # A tibble: 4 × 8
## 지역 국어 영어 수학 사회 음악 미술 체육
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 서울 27.6 60.3 58.4 16.4 22.8 14.5 32.9
## 2 광역시 25.5 52.4 53.1 14.7 18.2 10.9 27.2
## 3 중소도시 25.8 52.5 53.3 13.5 18.6 10.5 28.9
## 4 읍면지역 22.1 43.3 45.2 12.4 16.2 8 24
participate <- df_participate
변수명 변경
participate <- rename(participate, region = "지역",
korean = "국어",
english = "영어",
math = "수학",
history = "사회",
music = "음악",
art = "미술",
physical_education = "체육")
<각 과목별로 참여울이 가장 높은 곳과 낮은 곳 출력>
1.국어 과목의 참여율
summary(participate$korean)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 22.10 24.65 25.65 25.25 26.25 27.60
평균 25.65%
ggplot(data = participate, aes (x=region, y= korean)) + geom_col()

국어 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
2.영어 과목의 참여율
summary(participate$english)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 43.30 50.12 52.45 52.12 54.45 60.30
평균 52.45%
ggplot(data = participate, aes (x=region, y= english)) + geom_col()

영어 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
3.수학 과목의 참여율
summary(participate$math)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 45.20 51.12 53.20 52.50 54.58 58.40
평균 53.2%
ggplot(data = participate, aes (x=region, y= math)) + geom_col()

수학 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
4.사회 과목의 참여율
summary(participate$history)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 12.40 13.22 14.10 14.25 15.12 16.40
평균 14.10%
ggplot(data = participate, aes (x=region, y= history)) + geom_col()

사회 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
5.음악 과목의 참여율
summary(participate$music)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 16.20 17.70 18.40 18.95 19.65 22.80
평균 18.40%
ggplot(data = participate, aes (x=region, y= music)) + geom_col()

음악 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
6.미술 과목의 참여율
summary(participate$art)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 8.000 9.875 10.700 10.975 11.800 14.500
평균 10.70%
ggplot(data = participate, aes (x=region, y= art)) + geom_col()

미술 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
7.체육 과목의 참여율
summary(participate$physical_education)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 24.00 26.40 28.05 28.25 29.90 32.90
평균 28.25%
ggplot(data = participate, aes (x=region, y= physical_education)) + geom_col()

체육 과목의 참여율이 가장 높은 곳은 서울, 가장 낮은곳은
읍면지역
각 과목의 그래프를 통한 결과를 보면 참여율이 가장 높은 곳은 서울,
가장 낮은 곳은 읍면지역임을 알 수 있음.
<모든 지역을 통틀어 참여율이 가장 높은 과목과 낮은과목 알아보기>
1.subject라는 데이터 프레임 생성
subject <- data.frame(subject = c("korean",
"english",
"math",
"history",
"music",
"art",
"physical_education"))
2.데이터프레임에 과목별로 참여율 평균을 계산한 변수
생성
subject$average <- c(mean(participate$korean),
mean(participate$english),
mean(participate$math),
mean(participate$history),
mean(participate$music),
mean(participate$art),
mean(participate$physical_education))
3. 과목별 참여율 평균 그래프 생성
ggplot(data = subject, aes(x=subject, y = average)) + geom_col()

** 그래프를 통해 참여율이 가장 높은 과목은 수학, 가장 낮은 과목은
미술임을 알 수 있음**
<2.지역별 사교육비 분석>
데이터 불러오기
df_cost <- read_excel("C:\\Users\\user\\Desktop\\final project\\지역별사교육비.xlsx")
df_cost
## # A tibble: 4 × 9
## 지역 국어 영어 수학 사회 음악 미술 체육 총합
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 서울 5.4 17.4 16.9 3.1 4.3 2.4 5.7 55.2
## 2 광역시 3.4 12.1 11.4 1.8 2.7 1.6 3.9 36.9
## 3 중소도시 3.2 12.2 11.2 1.6 2.9 1.7 4.3 37.1
## 4 읍면지역 2.2 8.2 7.7 1.1 2.5 1.2 3.4 26.3
cost <- df_cost
head(cost)
## # A tibble: 4 × 9
## 지역 국어 영어 수학 사회 음악 미술 체육 총합
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 서울 5.4 17.4 16.9 3.1 4.3 2.4 5.7 55.2
## 2 광역시 3.4 12.1 11.4 1.8 2.7 1.6 3.9 36.9
## 3 중소도시 3.2 12.2 11.2 1.6 2.9 1.7 4.3 37.1
## 4 읍면지역 2.2 8.2 7.7 1.1 2.5 1.2 3.4 26.3
변수명 변경
cost <- rename(cost,region = "지역",
korean = "국어",
english = "영어",
math = "수학",
history = "사회",
music = "음악",
art = "미술",
physical_education = "체육",
total = "총합")
<각 과목별 사교육비 분석>
1.국어 과목의 사교육비
summary(cost$korean)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.20 2.95 3.30 3.55 3.90 5.40
평균 3.3만원
ggplot(data = cost, aes (x=region, y= korean)) + geom_col()

국어 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
2.영어 과목의 사교육비
summary(cost$english)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 8.20 11.12 12.15 12.47 13.50 17.40
평균 12.15만원
ggplot(data = cost, aes (x=region, y= english)) + geom_col()

영어 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
3.수학 과목의 사교육비
summary(cost$math)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 7.70 10.32 11.30 11.80 12.78 16.90
평균 11.3만원
ggplot(data = cost, aes (x=region, y= math)) + geom_col()

수학 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
4.사회 과목의 사교육비
summary(cost$history)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.100 1.475 1.700 1.900 2.125 3.100
평균 1.7만원
ggplot(data = cost, aes (x=region, y= history)) + geom_col()

사회 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
5.음악 과목의 사교육비
summary(cost$music)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 2.50 2.65 2.80 3.10 3.25 4.30
평균 2.85만원
ggplot(data = cost, aes (x=region, y= music)) + geom_col()

음악 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
6.미술 과목의 사교육비
summary(cost$art)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 1.200 1.500 1.650 1.725 1.875 2.400
평균 1.65만원
ggplot(data = cost, aes (x=region, y= art)) + geom_col()

미술 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
7.체육 과목의 사교육비
summary(cost$physical_education)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 3.400 3.775 4.100 4.325 4.650 5.700
평균 4.15만원
ggplot(data = cost, aes (x=region, y= physical_education)) + geom_col()

체육 과목의 사교육비가 가장 많이 드는곳은 서울, 가장
낮은곳은 읍면지역
각 과목의 그래프를 통한 결과를 보면 사교육비가 가장 많이 드는곳은
서울, 가장 적게 드는곳은 읍면지역임을 알 수 있음.
<모든 지역을 통틀어 사교육비가 가장 많이 드는 과목과 낮은과목 알아보기>
1.subject라는 데이터 프레임 생성
cost_subject <- data.frame(subject = c("korean",
"english",
"math",
"history",
"music",
"art",
"physical_education"))
2.데이터프레임에 과목별로 사교육비 평균을 계산한 변수
생성
cost_subject$average <- c(mean(cost$korean),
mean(cost$english),
mean(cost$math),
mean(cost$history),
mean(cost$music),
mean(cost$art),
mean(cost$physical_education))
3. 과목별 사교육비 평균 그래프 생성
ggplot(data = cost_subject, aes(x=subject, y = average)) + geom_col()

그래프를 통해 사교육비가 가장 많이 드는 과목은 영어, 가장
낮은 과목은 미술임을 알 수 있음