[STATSGRASS] R and GRASS multiple maps generation

javier garcia - CEBAS rn001 at cebas.csic.es
Thu Nov 6 11:18:09 EST 2003


Hello all;

Perhaps this is more a R question than a Statistics or GRASS one. But perhaps 
you can help:

I'm trying to check the performance of R to do simple operations with GRASS 
maps, and due to my lack of knowledge of R I'm finding the following problem:
-------------------
# Load a number of raster layers from GRASS.
 RGRASS <- rast.get(G, rlist="alb.dem", catlabels=FALSE)
# connect postgres
library(Rdbi.PgSQL)
conn <- dbConnect(PgSQL(), host="127.0.0.1", dbname="murciadb")
# copies a table of time series form the database into a data frame
series <- (dbReadTable(conn, 
table.name="series",row.names=NULL,col.names=NULL,as.is=FALSE))
# makes operations with the map and one of the series
for (i in 1:length(series$pto1)){
output <- RGRASS$alb.dem*series$pto1[i]
--- here is my problem ---
}

¿How could I say that for every data in the serie the output generated have a 
diferent name. For example output1,output2...?
Even better. ¿Could I store the different generated maps in a object so I 
could refer to them by an index. For example output[1]...?

Thanks for your help and best wishes

Javier





More information about the grass-stats mailing list