< 12 > googleVis 패키지
install.packages("googleVis")
library(googleVis)
library(ggplot2)
12-1)
gvisMotionChart(데이터세트, idvar = "기준데이터", timevar = "날짜 데이터")
gvisMotionChart() 함수로 얻은 결과 값으로 그래프를 그려주는 plot() 함수를 이용해 호출해야 함.
#### 날짜별(date) 개인 저축률의 변화(pasvert) 값을 구한 후 motion 변수에 할당
str(economics)
motion <- gvisMotionChart(economics, idvar="psavert", timevar = "date")
plot(motion) # motion 변수의 값으로 그래프 그리기
str(CityPopularity)
head(CityPopularity)
12-2)
gvisGauge(데이터 세트, lavelvar = "측정 데이터", numvar = "값", options = list(그래프옵션))
## 게이지의 측정 데이터(labelvar)는 도시명, 값(numvar)은 인구수, 눈금은 0~1000으로 옵션 지정
gauge <- gvisGauge(CityPopularity, labelvar="City", numvar="Popularity", options=list(min=0, max=1000))
plot(gauge) # gauge 변수 값으로 그래프 그리기