Here is an example of how I would do it. Just replace my ‘indx’ with the values in your first column.


indx <- 1:13
t0 <- as.POSIXct('2009-01-01 00:00')
tms <- t0 + (indx -1 )* 3 * 60 * 60

> tms
 [1] "2009-01-01 00:00:00 PST" "2009-01-01 03:00:00 PST"
 [3] "2009-01-01 06:00:00 PST" "2009-01-01 09:00:00 PST"
 [5] "2009-01-01 12:00:00 PST" "2009-01-01 15:00:00 PST"
 [7] "2009-01-01 18:00:00 PST" "2009-01-01 21:00:00 PST"
 [9] "2009-01-02 00:00:00 PST" "2009-01-02 03:00:00 PST"
[11] "2009-01-02 06:00:00 PST" "2009-01-02 09:00:00 PST"
[13] "2009-01-02 12:00:00 PST"


Your timezone will probably be different than mine, of course.

-Don


On 9/30/10 8:59 AM, "Yogesh Tiwari" <yogesh.mpi@googlemail.com> wrote:

Dear R Users,
I did not get any reply on my question so I am re-asking.

This time I am giving sample data:

     1        60.3162  -13.5993   -0.4353   46.0938    0.1877  -0.194E-07
     2        60.3713  -13.5992   -0.4423   46.1241    0.2057  -0.231E-06
     3        60.3430  -13.5981   -1.6163   44.9048    0.2237  -0.270E-06
     4        60.3227  -13.5970   -2.6258   43.8785    0.2213  -0.139E-06
     5        60.3352  -13.5961   -2.5874   43.9238    0.2278   0.141E-06
.......
.....
......
  1918      59.1785  -14.5851    0.3895   44.9850   -0.0021   0.141E-06
  1919      59.1816  -14.5622    0.3933   44.9972    0.0155   0.139E-06
  1920      59.1637  -14.5666    0.4420   45.0219    0.0172   0.138E-06

Column 1, is index of hours on 3 hourly interval and starts from 1 Jan 2009,
00 hrs and run till 240 days of  2009.
I want to convert Column 1 of above data in the format, 'year' , 'month',
'day',  'hour'

Kindly help.

Thanks,

Regards,
Yogesh

My question is below

Dear R Users,
>
> I have model simulated data for 240 days.
>
> The day 1 is Jan 1, 2009, 00:00 hrs and then with 3-hourly interval and so
> on.
>
> The time axis is 1,2,3,4......1920;   so the total rows in the data are
> 1920.
>
> How to convert above time axis in  "year" "month" "day" "hour" format
>
> Great Thanks,
>
> regards,
> Yogesh
>
>
>


--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
925 423-1062

	[[alternative HTML version deleted]]

