[R] Date calculation
Jacques VESLOT
jacques.veslot at good.ibl.fr
Fri Jun 9 15:45:17 CEST 2006
> test
V1 V2
1 5/2/2006 36560
2 5/3/2006 36538
3 5/4/2006 36452
4 5/5/2006 36510
5 5/8/2006 36485
6 5/9/2006 36502
7 5/10/2006 36584
8 5/11/2006 36571
> dates <- strptime(test$V1, "%d/%m/%Y")
-------------------------------------------------------------------
Jacques VESLOT
CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex
Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31
http://www-good.ibl.fr
-------------------------------------------------------------------
stat stat a écrit :
> Dear all R users,
>
> Suppose I have a data frame "data" like this:
>
> 5/2/2006 36560
> 5/3/2006 36538
> 5/4/2006 36452
> 5/5/2006 36510
> 5/8/2006 36485
> 5/9/2006 36502
> 5/10/2006 36584
> 5/11/2006 36571
>
> Now I want to create a for loop like this:
>
> date = "5/10/2006"
> for (i in 1: 8)
> {
> if (data[i,1] > date) break
> }
>
> But I get error while executing this. Can anyone tell me the right way to do this?
>
> Sincerely yours
> stat
>
> Send instant messages to your online friends http://in.messenger.yahoo.com
>
> Stay connected with your friends even when away from PC. Link: http://in.mobile.yahoo.com/new/messenger/
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list