Skip to contents

.vAttachDatabase() adds a table to a GRASS vector. This table is meant to be "invisible" to most users–they should use interact with attribute tables using the GVector slot @table. Some functions require tables (e.g., extract() and spatSample()). This function is mostly of use to developers.

Usage

.vAttachDatabase(x, table = NULL, replace = TRUE, cats = NULL)

Arguments

x

A GVector or the name of a vector in GRASS.

table

Either NULL (default), or a data.frame or data.table, or a numeric or integer vector:

  • If NULL, then a bare minimal table will be created with a column named cat, holding sequential integer values.

  • If a data.frame or data.table and no column is named cat, one will be created with sequential integer values. If the table does have a column named cat, then it should have integer (not just numeric) values.

  • If a vector, then these are coerced to type integer and used to define the cat column.

There should be one row/value per geometry in x.

replace

Logical: If TRUE, replace the existing database connection.

cats

Either NULL (default), or an integer vector: This is provided as a means to save time by passing cats to this function if it has already been generated by a calling function.

Value

Invisibly returns the sources() name of a vector in GRASS.