Description
This command will write values from an R vector to an attribute table using an integer unique ID field to relate the two sets of data. This command is designed to be used in conjunction with the r.loaddata command, and subsequent processing of that data in R using the r() command. If a new R vector results from this processing, it can be added as a new field to the attribute table of the original data source. You should ensure that the lengths of the vectors referenced by the 'ruid' and 'rvector' parameters are identical. Note that R is case sensitive.
Syntax
r.writedatatofield(ruid, rvector, out, uidfield, datafield, fieldtype);
| ruid | the R vector containing the integer unique ID values corresponding to the values in 'uidfield' | |
| rvector | the R vector containing the data values to be written | |
| out | the output feature data source | |
| uidfield | the unique ID field name (must be an integer field) | |
| datafield | the name of the new data field to create | |
| fieldtype | the field data type - short integer, long integer, double precision real number, or string (options: SHORT, LONG, DOUBLE, STRING) |
Example
r.writedatatofield(ruid="PntID", rvector="weight", out="C:\data\samples.shp", uidfield="PntID", datafield="WEIGHT", fieldtype="DOUBLE");
r.writedatatofield(ruid="FID", rvector="label", out="C:\data\lakes.shp", uidfield="FID", datafield="MAPLABEL", fieldtype="STRING");