Time series data

Published onesixx on

시계열 데이터 (ts)

co2 {datasets}

1959~1997년까지(39년간) 월별 CO2농도 468개 (from Mauna Loa observatory )

R

sunspots {datasets}

https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/sunspot.month.html

흑점 갯수의 월별평균값 1749–1983

R

AirPassengers {datasets}

R
R

TS => Data.table

from co2 (using zoo)

http:// Heading https://www.rdocumentation.org/packages/zoo/versions/1.8-6

co2 %>% time() %>% as.yearmon() %>% as.Date() %>% class

R

from AirPassengers (using broom)

broom::tidy.ts (fortify) 로 data.frame형태로 변경가능

https://cran.r-project.org/web/packages/broom/vignettes/broom.html
https://ggplot2.tidyverse.org/reference/fortify.html

fortify()대신 broom의 tidy()사용

R

ggfortyfy는 ggplot2::autoplot()를 이용해서 ts object를 그릴수 있도록 도와준다.

R

Data.table => Xts

co2ts (from co2new)

최근 Full data  from Earth System Research Laboratory
R
R

ts object 만들기

  • index : Index (i.e. date or time) for the “ts” object.
  • series : Name of the series (multivariate “ts” objects only).
  • value : Value of the observation.
R

Airline Flights From NYC

nycflights13 2013년 New York를 출발한 항공데이터

R

numeric => Data.table (with Index)

river ( Index가 없는 Single Numeric)

R

from Web Data

GDP Growth Data

R

example

https://www.neonscience.org/dc-convert-date-time-POSIX-r
R
R
R
Categories: tsR Basic

onesixx

Blog Owner

guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x