[R] DEM calculation
Eric Lecoutre
lecoutre at stat.ucl.ac.be
Thu Jun 2 11:28:11 CEST 2005
You can use ´expand.grid'
» expand.grid(x=seq(42.2,45.2,by=1),y=seq(50.5,51.5,by=1))
x y
1 42.2 50.5
2 43.2 50.5
3 44.2 50.5
4 45.2 50.5
5 42.2 51.5
6 43.2 51.5
7 44.2 51.5
8 45.2 51.5
Eric
Eric Lecoutre
UCL / Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium
tel: (+32)(0)10473050
lecoutre at stat.ucl.ac.be
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre
If the statistics are boring, then you've got the wrong numbers. -Edward
Tufte
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Lars Claussen
> Sent: jeudi 2 juin 2005 10:56
> To: R-help at stat.math.ethz.ch
> Subject: [R] DEM calculation
>
>
> 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 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