<div>Thanks for both, Markus and Roger Bivand.</div>
<div> </div>
<div>Cheers</div>
<div> </div>
<div>milton<br><br></div>
<div class="gmail_quote">2009/5/5 Roger Bivand <span dir="ltr"><<a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>>From spgrass6 0.6-*, and after installing the R XML package (off CRAN but<br>installs automatically from Prof. Ripley's extra Windows repository if you<br>
are on Windows), you can use:<br><br>rasterfiles <- execGRASS("g.mlist", parameters=list(type="rast",<br>pattern="*ele*"), intern=TRUE)<br><br>(here from spearfish, which has *ele* rasters in PERMANENT). Do:<br>
<br>parseGRASS("g.mlist")<br><br>to see the flags and parameters. As Markus pointed out, intern=TRUE is the<br>key argument, to get the output of the GRASS command back into the R<br>workspace. There are issues with regard to quoting between platforms for a<br>
few GRASS commands, but most things now work. I tried this on MSYS Windows<br>native 6.4.0 RC4.<br><br>Roger<br>
<div>
<div></div>
<div class="h5"><br><br><br>Milton Cezar Ribeiro wrote:<br>><br>> Hi Markus,<br>><br>> Under windows I needed only small changes<br>><br>> rasterfiles <- read.table(textConnection(system("g.mlist.exe rast<br>
> pattern=*output*", intern = TRUE)))<br>> Thanks a lot,<br>><br>> milton<br>><br>> 2009/5/4 Markus Neteler <<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>><br>><br>>> On Mon, May 4, 2009 at 8:57 PM, Milton Cezar Ribeiro<br>
>> <<a href="mailto:miltinho.astronauta@gmail.com">miltinho.astronauta@gmail.com</a>> wrote:<br>>> > Dear all,<br>>> ><br>>> > I am running R inside GRASS 6.4 and I can see a list<br>
>> > of all my raster files when I type (from the R session)<br>>> ><br>>> > system("g.list rast")<br>>> ><br>>> > But I would like to pass the list of rasters to a vector object in R.<br>
>> ><br>>> > I tryed innocently this, but not worked:<br>>> ><br>>> > my.rast.list<-system("g.list rast")<br>>><br>>> Try this:<br>>><br>>> > rasterfiles <- read.table(textConnection(system("g.mlist rast",intern =<br>
>> TRUE)))<br>>> > str(rasterfiles)<br>>> 'data.frame': 42 obs. of 1 variable:<br>>> $ V1: Factor w/ 42 levels "aspect","basin_50K",..: 31 1 2 3 4 5 6 7 8 9<br>>> ...<br>
>> > rasterfiles<br>>> V1<br>>> 1 myfacility<br>>> 2 aspect<br>>> 3 basin_50K<br>>> 4 boundary_county_500m<br>>> ...<br>
>><br>>> > I also would like to define a pattern of raster names to the g.list<br>>> command,<br>>> > like only return that raster names that have "_output_" on the name.<br>>><br>
>> So:<br>>> > rasterfiles <- read.table(textConnection(system("g.mlist rast<br>>> pattern="*_output_*",intern = TRUE)))<br>>> > str(rasterfiles)<br>>><br>>><br>
>><br>>> > By the way, I am running GRASS inside MSYS, under windows.<br>>><br>>> Please report if above works (as it does on Linux).<br>>><br>>> Markus<br>>><br>><br></div>
</div>> _______________________________________________<br>> grass-user mailing list<br>> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>> <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
><br>><br><br><br>-----<br>Roger Bivand<br>Economic Geography Section<br>Department of Economics<br>Norwegian School of Economics and Business Administration<br>Helleveien 30<br>N-5045 Bergen, Norway<br><font color="#888888"><br>
--<br>View this message in context: <a href="http://n2.nabble.com/passing-output-from-GRASS-to-R.-tp2788835p2791576.html" target="_blank">http://n2.nabble.com/passing-output-from-GRASS-to-R.-tp2788835p2791576.html</a><br>
Sent from the Grass - Users mailing list archive at Nabble.com.<br><br>_______________________________________________<br>grass-user mailing list<br><a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></font></blockquote></div><br>