[R] gridding values in a data frame

2009-04-30 Thread dxc13
Hi all, I have a data frame that looks like such: LATITUDE LONGITUDE TEMPERATURE TIME 36.73 -176.4358.32 1 50.9590.0074.39 1 -30.425.4523.26 1 15.81 -109.3152.44 1

Re: [R] gridding values in a data frame

2009-04-30 Thread jdeisenberg
dxc13 wrote: Hi all, I have a data frame that looks like such: LATITUDE LONGITUDE TEMPERATURE TIME 36.73 -176.4358.32 1 and this goes on for a A LOT more records, until time=1200 I want to create a 5 degree by 5 degree grid of this data, with the

Re: [R] gridding values in a data frame

2009-04-30 Thread hadley wickham
It's hard to check without a reproducible example, but the following code should give you a 3d array of lat x long x time: library(reshape) df$lat - round_any(df$LATITUDE, 5) df$long - round_any(df$LONGITUDE, 5) df$value - df$TIME cast(df, lat ~ long ~ time, mean) On Thu, Apr 30, 2009 at

Re: [R] gridding values in a data frame

2009-04-30 Thread dxc13
Thank you for your input. I will give it a try and see how it works out. I always have the same problem when programming...I always make things more complicated than they really are :-). Much appreciated. jdeisenberg wrote: dxc13 wrote: Hi all, I have a data frame that looks like