######## 슬라이드 76. 연습문제
# 1번
str(cars)
plot(cars$speed)
plot(cars$dist)
hist(cars$speed)
hist(cars$dist)
str(mpg)
# 2번
str(mtcars)
ggplot(mtcars, aes(x=cyl)) +
geom_bar()
ggplot(mtcars, aes(x=cyl)) +
geom_bar(fill=rainbow(3))
ggplot(mtcars, aes(x=mpg, y=qsec)) +
geom_line()
ggplot(mtcars, aes(x=mpg, y=qsec)) +
geom_point()
ggplot(mtcars, aes(x=mpg, y=qsec, color=gear)) +
geom_point(aes(fill=gear))
ggplot(mtcars, aes(x=mpg)) +
geom_histogram()
ggplot(mtcars, aes(x=mpg)) +
geom_histogram(binwidth = 5)
# mtcars의 cyl(x축), qsec(y축)으로 상자그림 출력(geom_boxplot)
ggplot(mtcars, aes(x=cyl, y=qsec, group=cyl)) +
geom_boxplot()