GRASS vector attribute table read into R

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GRASS vector attribute table read into R

stephen sefick
I would like to just read in a vector table that is stored in the
GRASS dbf format into R.  Is there a way that I am over looking with
the spgrass6 package?  I can just go to the dbf file of the grass
mapset, but I was looking for a better option.  Thanks in advance.
kindest regards,

--
Stephen Sefick
____________________________________
| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___________________________________|
| [hidden email]                             |
| http://www.auburn.edu/~sas0025             |
|___________________________________|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                              -Robert Gentleman
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: GRASS vector attribute table read into R

Roger Bivand
Administrator
On Mon, 18 Oct 2010, stephen sefick wrote:

> I would like to just read in a vector table that is stored in the
> GRASS dbf format into R.  Is there a way that I am over looking with
> the spgrass6 package?  I can just go to the dbf file of the grass
> mapset, but I was looking for a better option.  Thanks in advance.
> kindest regards,

Stephen,

Do you mean read the GRASS vector, or just the DBF file? If the vector
with its attributes, readVECT6() in spgrass6, which I think you know of.
Otherwise, perhaps:

zz <- execGRASS("db.select", parameters=list(table="newbugs"),
   intern=TRUE)
con <- textConnection(zz)
zzz <- read.table(con, header=TRUE, sep="|")
close(con)

Hope this helps,

Roger


>
> --
> Stephen Sefick
> ____________________________________
> | Auburn University                                   |
> | Department of Biological Sciences           |
> | 331 Funchess Hall                                  |
> | Auburn, Alabama                                   |
> | 36849                                                    |
> |___________________________________|
> | [hidden email]                             |
> | http://www.auburn.edu/~sas0025             |
> |___________________________________|
>
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods.  We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>                                 -K. Mullis
>
> "A big computer, a complex algorithm and a long time does not equal science."
>
>                               -Robert Gentleman
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
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: [hidden email]
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: GRASS vector attribute table read into R

Sarah Goslee
An even more straight-forward way is to use read.dbf() from the
foreign package.

Sarah

On Tue, Oct 19, 2010 at 4:24 PM, Roger Bivand <[hidden email]> wrote:

> On Mon, 18 Oct 2010, stephen sefick wrote:
>
>> I would like to just read in a vector table that is stored in the
>> GRASS dbf format into R.  Is there a way that I am over looking with
>> the spgrass6 package?  I can just go to the dbf file of the grass
>> mapset, but I was looking for a better option.  Thanks in advance.
>> kindest regards,
>
> Stephen,
>
> Do you mean read the GRASS vector, or just the DBF file? If the vector with
> its attributes, readVECT6() in spgrass6, which I think you know of.
> Otherwise, perhaps:
>
> zz <- execGRASS("db.select", parameters=list(table="newbugs"),
>  intern=TRUE)
> con <- textConnection(zz)
> zzz <- read.table(con, header=TRUE, sep="|")
> close(con)
>
> Hope this helps,
>
> Roger
>
>
>>


--
Sarah Goslee
http://www.functionaldiversity.org

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo