컨트롤+알트+i: 블록 설정
library(ggplot2)
library(gapminder)
library(dplyr)
##
## 다음의 패키지를 부착합니다: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# info() -> glimpse()
glimpse(gapminder)
## Rows: 1,704
## Columns: 6
## $ country <fct> "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", …
## $ continent <fct> Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, …
## $ year <int> 1952, 1957, 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1997, …
## $ lifeExp <dbl> 28.801, 30.332, 31.997, 34.020, 36.088, 38.438, 39.854, 40.8…
## $ pop <int> 8425333, 9240934, 10267083, 11537966, 13079460, 14880372, 12…
## $ gdpPercap <dbl> 779.4453, 820.8530, 853.1007, 836.1971, 739.9811, 786.1134, …
ggplot(gapminder,aes(x=gdpPercap,y=lifeExp,col=continent))+
geom_point()+scale_x_log10()

# 로그 스케일 사용: 데이터의 작은 값과 큰 값을 더 잘 비교할 수 있도록 시각화
ggplot(gapminder,aes(x=gdpPercap,y=lifeExp,
col=continent,size=pop))+geom_point()+scale_x_log10()

ggplot(gapminder,aes(x=gdpPercap,y=lifeExp,
col=continent,size=pop))+geom_point(alpha=0.5)+
scale_x_log10()

ggplot(gapminder,aes(x=gdpPercap,y=lifeExp,
col=continent,size=pop))+geom_point(alpha=0.5)+
scale_x_log10()+ facet_wrap(~year) # 시계열 배열로 데이터 쪼개서 볼 경우

# facet_wrap()은 지정된 변수(또는 표현식)를 기준으로 데이터를 분할