GME

Geospatial Modelling Environment

r.loaddata (Load Data Into R)

Loads data from a vector attribute table into the current R session

Description

This command will read data from a vector data attribute table and load it into the current R session (every instance of GME has a hidden R session - you can use the r.ls() command to view the objects in that session). The 'fields' parameter is used to define which fields will be read, and the optional 'where' parameter can be used to define a subset of rows. There are two important issues to be aware of when using this tool. First, the order in which records from an attribute table are returned is not always the same, so if this command is called multiple times on the same dataset there is a risk the order of values in the resulting R vectors will be misaligned! Thus, it is important to specify all of the fields you want to load into R in a single call to this command (the 'fields' parameter can be a vector of multiple field names). If you do this you can be sure that the order of values in each vector will be correct.

The second issue to be aware of is the need for an integer unique ID field in the attribute table that you can use to relate the R vectors (or new R vectors) back to the attribute table. If you perform an analysis that generates a new R vector as output, for instance, and you wish to write those values back to the attribute table then this unique ID field is essential for assigning the correct value from an R vector back to the attribute table. So if you need to maintain a relational link between the R data and the original attribute table then be sure to specify an integer unique ID field in the list of fields that will be loaded. See the r.writedatatotable command for an example of how this can be used.

The objects in R will have the same name as the fields from which they were written. Note that R is case sensitive.

Syntax

r.loaddata(in, fields, [where]);

inthe input feature data source
fieldsthe names of field or fields containing the data to load
[where]the selection statement that will be applied to the feature data source to identify a subset of features to process (see full Help documentation for further details)

Example

r.loaddata(in="C:\data\parcels.shp", field="Value08");

r.loaddata(in="C:\data\county.shp", fields=c("FID", "Popn","Area","Name"), where="STATE='WI'");


Messages

Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn