[GRASSLIST:7379] Re: Making R and Grass (6.1) play well together...

Tom Colson tom_colson at ncsu.edu
Wed Jun 29 12:55:15 EDT 2005


To answer my own question...

start R from within Grass...



library(spgrass6)
G <-gmeta6()
dem <-readFLOAT6sp("timb_elev")
dem.def = as.data.frame(dem)
plot(ecdf(dem.def[["timb_elev"]]))
plot(density(dem.def[["timb_elev"]]))
lines(density(dem.def[["timb_elev"]],bw=2),col="green")
lines(density(dem.def[["timb_elev"]],bw=4),col="cyan")
lines(density(dem.def[["timb_elev"]],bw=8),col="red")
lines(density(dem.def[["timb_elev"]],bw=12),col="yellow")

legend(locator(), legend=c("bw=0","bw=2","bw=4","bw=8","bw=12"),
col=c("black","green","red","cyan","yellow"), lty=1)







On Wed, 2005-06-29 at 10:05 -0400, Tom Colson wrote:
> I managed to get R compiled and all the packages talking to grass as it
> should, and all the "demos" seem to work. There is a neat tutorial on
> working with DEM (grass raster) in R
> http://grass.itc.it/statsgrass/learning_r2.html#Working_with_elevation
> 
> Tutorial works great with the sample data provided...yet I can't figure
> out how to get "current" raster dems in my mapset/location into a format
> that is acceptable to R...re: the tutorial syntax. Been looking through
> all the man pages, but there doesn't seem to be any documentation on
> raster import that would allow one to go through that tutorial using
> one's own data....
> 
> thanks. 
> 




More information about the grass-user mailing list