This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
install.packages(“ggplot2”) install.packages(“dplyr”)
보고일자: 2025년 6월 9일 (월요일)
보고 장소: 수원특례시
보고 담당 직원: 마케팅 팀2부 000
자동차의 cty(도시 연비) 변수가 전체적으로 어떻게 분포되어 있는지
히스토그램을 통해 시각화합니다.
drv(구동 방식)에 따라 색을 달리하여 그룹을 구분했습니다.
조건:
- binwidth = 2
- fill = drv
- position = "identity"
- alpha = 0.5
library(ggplot2)
library(dplyr)
mpg$drv <- as.factor(mpg$drv)
ggplot(mpg, aes(x = cty, fill = drv)) +
geom_histogram(position = "identity", binwidth = 2, alpha = 0.5)
해석:
- 도시 연비가 15~20 사이에 많이 분포하며, 후륜 구동이 평균적으로 연비가
낮은 경향을 보임
자동차의 등급(class)에 따라 도시 연비(cty)에 차이가 있는지 상자 그림(Boxplot)을 통해 비교합니다.
ggplot(mpg, aes(x = class, y = cty)) +
geom_boxplot()
해석:
- pickup, suv는 연비가 낮고,
compact, subcompact는 연비가 높은 편이다.
변속기별(trans)로 그룹을 나누고 구동
방식(drv)을 색상으로 구분하여 고속도로
연비(hwy) 분포를 확인합니다.
ggplot(mpg, aes(x = hwy, fill = drv)) +
geom_histogram(binwidth = 2, alpha = 0.5) +
facet_wrap(~trans)
해석:
- manual보다 auto에서 연비 분포가 넓게
나타나고,
4륜 구동 차량은 전체적으로 연비가 낮은 편이다.
이상 보고를 마칩니다. 감사합니다.