T"
#[5] "2004-01-04 02:30:00 GMT" "2004-01-04 03:30:00 GMT"
index(y.1)<-update(index(y.1),month=unique(month(index(x.1))))
y.1
# [,1]
#2004-01-04 01:15:00 1
#2004-01-04 01:30:00 2
#2004-01-04 01:45:00 3
#2004-01-04 02:00:00 4
#2004-01-04
4
#2004-01-07 02:30:00 5
#2004-01-07 03:30:00 6
Hope it helps.
A.K.
From: Eric Morway
To: arun
Cc: R help
Sent: Saturday, November 3, 2012 12:32 PM
Subject: Re: [R] override date in xts time series
Sys.setenv(TZ="GMT") did
the trick! Th
Sys.setenv(TZ="GMT") did the trick! Thank you very much. I'll continue
to work the larger problem with this option.
Out of curiosity, however, can the following code be modified so that the
replacement argument is informed by the month of x.1?:
index(y.1)<-as.POSIXct(gsub("(.*\\-).*(\\-.*)","
Hello Arun,
I too am using R 2.15 and am unable to get the same result as you. You
will notice in the R code that follows that when I use 'update' the time
in the xts object goes haywire. For example, "2004-04-04 01:15:00 EST"
gets converted to "2004-01-03 22:15:00 PST" (see below). Because
1-04 02:30:00 5
#2004-01-04 03:30:00 6
I hope this helps.
A.K.
____
From: Eric Morway
To: arun
Cc: R help
Sent: Friday, November 2, 2012 8:52 PM
Subject: Re: [R] override date in xts time series
Hello Arun,
My earlier example was not very robus
can use:
library(lubridate)
index(y.1)<-update(index(y.1),month=1)
#or
index(y.1)<-update(index(y.1),month=unique(month(index(x.1))))
y.1
[,1]
#2004-01-01 00:00:001
#2004-01-01 00:15:002
#2004-01-01 00:45:003
#2004-01-01 01:00:004
A.K.
- Original
2004-01-01 01:00:00 4
A.K.
- Original Message -
From: Eric Morway
To: r-help@r-project.org
Cc:
Sent: Friday, November 2, 2012 7:55 AM
Subject: [R] override date in xts time series
Using the following bit of R, I'm wondering if there is a way to
override/manipulate/replace the
4
A.K.
- Original Message -
From: Eric Morway
To: r-help@r-project.org
Cc:
Sent: Friday, November 2, 2012 7:55 AM
Subject: [R] override date in xts time series
Using the following bit of R, I'm wondering if there is a way to
override/manipulate/replace the date in one xts time seri
Using the following bit of R, I'm wondering if there is a way to
override/manipulate/replace the date in one xts time series with the date of
another xts time series while not affecting/changing the times of the xts
time series?
library(xts)
x.Date <- rep("1/1/2004",times=
9 matches
Mail list logo