Suggest you read the article in R News 4/1 on dates and times and
try this:
library(zoo)
library(chron)
z <- zoo(101:200, seq(chron("1/1/2000"), length = 100))
zz <- z[with(month.day.year(time(z)), day >= 21 & month %% 2 == 1)]
zz[!duplicated(as.yearmon(time(zz)))]
On Nov 19, 2007 9:57 PM, Ca
many thanks Gabor.
Q1:
if i want to do with the following 2 conditions, how can i do?
condition 1) every n-th day
condition 2) every x-month <-x = 1 to 12
Eg:
condition 1) every 21-th day
condition 2) every 2-month
1st data: 2000-01-21 100
2nd data: 2000-03-21 101
3rd data: 2000-05-21
Carles Fan a écrit :
> Dear all
>
> i have a time series containing trading dates and historical stock prices:
> Date Price
> 10-Jan-2007 100
> 11-Jan-2007 101
> 13-Jan-2007 99
> ..
> ..
> ..
> 10-Nov-2007 200
>
> i want to sample every 21st data of each month:
> 21-Ja
On Nov 15, 2007 12:54 PM, Carles Fan <[EMAIL PROTECTED]> wrote:
> Dear all
>
> i have a time series containing trading dates and historical stock prices:
> Date Price
> 10-Jan-2007 100
> 11-Jan-2007 101
> 13-Jan-2007 99
> ..
> ..
> ..
> 10-Nov-2007 200
>
> i want to samp
Dear all
i have a time series containing trading dates and historical stock prices:
Date Price
10-Jan-2007 100
11-Jan-2007 101
13-Jan-2007 99
..
..
..
10-Nov-2007 200
i want to sample every 21st data of each month:
21-Jan-2007 101
21-Feb-2007 111
21-Mar-2007 131
..
5 matches
Mail list logo