[GRASS-stats] Load data multiple data from grass to R

Roger Bivand Roger.Bivand at nhh.no
Wed Nov 21 17:14:55 EST 2007


On Wed, 21 Nov 2007, Jarek Jasiewicz wrote:

> I'd like to write R sript to read more rasters from grass to R and writeh 
> them to objects with unique
>
> what I try to do:
>
> system("g.mlist type=rast pattern=a_* >tmp_file")
> k=c(scan("temp_file, what="string")) //maybe is simpler way
>
> for (i in k) {
> here_I_need_obect_with_unique_name=readRAST6(i, paste(i))
> }
> operations_on_obiects

Could you use the fact that the first argument to readRAST6() can be a 
character vector of raster layer names? If k is such a character vector, 
you could try readRAST6(k). The second argument is a logical vector, not 
vname= as you seem to think - that is in writeRAST6().

Hope this helps,

Roger

>
> I expect it could be more complicated than one line, but I complelty cannot 
> find solution. It seems very unintuitive
>
> I know that I can use:
>
> obiect <-readRAST6(k)
>
> but how to split it on separate obiects
> maybe this is better solution?
>
> Jarek
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the grass-stats mailing list