[R] How to assign time series to a vector with one leap year

arun smartpink111 at yahoo.com
Wed Jan 23 00:15:50 CET 2013


HI,
You can check this link:
http://r.789695.n4.nabble.com/leap-years-in-temporal-series-command-ts-td3309014.html

Also, this may help you:
library(lubridate), ?leap_year()
 leap_year(2008)
#[1] TRUE
 ymd("2008-2-29")
 1 parsed with %Y-%m-%d
#[1] "2008-02-29 UTC"
A.K.




----- Original Message -----
From: Janesh Devkota <janesh.devkota at gmail.com>
To: r-help at r-project.org
Cc: 
Sent: Tuesday, January 22, 2013 2:46 PM
Subject: [R] How to assign time series to a vector with one leap year

Hello All,

I am trying to do the time series analysis in R and I want to assign a
vector as a time series. The data I provided is hourly. The data is from
Jan 1 2008 to Dec 31 2009. How can I assign the data such that the first
year is leap year and second is not ?

airtemp <- read.csv("airtemp.csv",header=T,sep="")

aw <- ts(airtemp,start=2008,frequency=8784,end=2009)

I assigned frequency as 8784 because 2008 year will have 8784 hourly data
points and 2009 has 8760 data points. The total data points are 17544

The data can be found on
https://www.dropbox.com/s/03z74632v1f3g1e/airtemp.csv

I apologize if this is very trivial to some of you.

Thanks.

    [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list