[R] DEM calculation

From: Lars Claussen <LarsVegas_at_nikocity.de>
Date: Thu 02 Jun 2005 - 18:56:13 EST


Hello R-World,

i am trying to calculate data for a DEM (Digital Elavation Model) which i also want to plot in R. i have the coordinates for the lower left corner which look something like this:

x<-42,2
y<-50,5

besides i have the cellsize of the grid, which is:

z<-1,1

what i do is to calculate the corrdinates of the cells to the right and top, what i can do by specifying the number of rows and columns. these are j<-1:805 (columns)
i<-1:616 (rows)

well, to calculate them seperatly is easy:

r<-x+(i-1)*z
h<-y+(j-1)*z

but i can't get it straight how to create a data frame with two rows, one for the x- the other for the y-coordinate. The problem is, that lots of values have to be repeated as every first row x-coordinate has the same y-coordinate and so on.

finally it should look like this:

x y

42,2   50,5
43,3   50,5
44,4   50,5
45,5   50,5

. .
. .
42,2 51,5

43,3 51,5
44,3 51,5

any suggestion? thanks in advance, Lars Claussen



R-help@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 Received on Thu Jun 02 19:04:58 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:21 EST