[R] 3d average values

chuck.01 CharlieTheBrown77 at gmail.com
Tue Feb 7 02:54:28 CET 2012


Hello, 
given the set of grey points (corners of squares, see visual)... something
like  this:

http://r.789695.n4.nabble.com/file/n4363505/Slide2.png 

how do I calculate the average value of the variable z, that was measured at
the corners of the rectangles (represented by the black points in  the
picture above). 

#here is some data (dat)

dat <- structure(list(z = c(0L, 0L, 0L, -1L, 0L, -1L, 0L, -1L, -1L, 
+ 0L, 0L, 0L, -1L, -1L, 0L, 0L, -1L, -1L, 0L, 0L), x = c(-0.6, 
+ 0, 0, 0, 0.4, 0.6, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3.8, 4
+ ), y = c(1, 0, 2, 0.8, 3, 1.6, 0.19, 1, 2.6, 1, 4, 3.7, 2, 3, 
+ 1.6, 3.8, 2.4, 3, 3, 1.9)), .Names = c("z", "x", "y"), class =
"data.frame", row.names = c(12L, 
+ 1L, 11L, 13L, 10L, 20L, 2L, 14L, 19L, 3L, 8L, 9L, 15L, 18L, 4L, 
+ 7L, 16L, 17L, 6L, 5L))

attach(dat) 
library(akima) 
# interpolating to square grid
data.interp <- interp(x,y,z) 

I would like the "black dots" (rectangle corner averages) from
data.interp[z] anybody know how? 


--
View this message in context: http://r.789695.n4.nabble.com/3d-average-values-tp4363505p4363505.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list