Skip to contents

GRASS vectors can be linked to an attribute table, which can be exported from GRASS to R using this function. This function is mostly of use to developers.

Values in the cat column are not necessarily unique–if a value appears more than once, the set of features they index are (in other software) called "multipart" features. The table can have more columns with metadata for each feature.

This function is typically used by developers.

Usage

.vAsDataTable(x)

Arguments

x

A GVector or the name of a vector in GRASS.

Value

A data.table or NULL if the vector is not attached to a database.

Examples

if (grassStarted()) {

madRivers <- fastData("madRivers")
rivers <- fast(madRivers)

.vCats(rivers)
.vHasDatabase(rivers)
.vAsDataTable(rivers)
.vRecat(rivers) # dangerous--re-categorizes geometries!
.vValidCats(rivers)

.vDetachDatabase(rivers) # dangerous--detaches database!
.vAttachDatabase(rivers)

# Ensure we don't use this for other examples!
.rm(rivers) # delete in GRASS
rm(rivers) # delete in R

}