R
ggplot2 패키지로 산점도 작성하기
이부일
2017. 10. 22. 18:29
# 엑셀 파일에서 Ctrl + C한 데이터를 불러오기
baseball <- read.table("clipboard", header = TRUE)
# 산점도 작성하기
ggplot(data = baseball, aes(x = 타율, y = 방어율)) +
geom_point(col = "blue") +
geom_text(aes(label = 팀), size = 4, data = baseball) +
geom_smooth(method = "lm") +
labs(title = "산점도",
subtitle = "타율과 방어율",
x = "타율",
y = "방어율",
caption = "2017년 한국야구 데이터")