da_insert: Insert Table with arcpy.da

Description Usage Arguments Value See Also Examples

View source: R/utils.r

Description

Insert rows into a table (e.g. attribute table of a layer) with the arcpy.da module.

Usage

1
da_insert(table.path, d, fmt)

Arguments

table.path

The file path to the table.

d

The data to write to table.path. Column names must match field names of the table.

fmt

Vector of formats for the columns in d. If missing, the format will be automatically detected as numeric (%f), integer (%d), or string (%s). See sprintf for more information on format strings.

Value

The path to the table, i.e. table.path.

See Also

sprintf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# create an empty table
library(arcpyr)
connect_ArcPython()
arcpy = arcpy_env(NULL, NULL)
attach_toolbox(arcpy, "management")
folder = "path/to/folder"
name = "table name"
arcpy$management$CreateTable(folder, name)
# create fields in new table
arcpy$management$AddField(file.path(folder, name), "ID", "SHORT")
arcpy$management$AddField(file.path(folder, name), "VALUE", "FLOAT")
arcpy$CreateTable_management(outpath, tablename)
# generate table contents in R
d = data.frame(ID = seq(10), VALUE = rnorm(10))
# write data to table
da_insert(file.path(folder, name), d)

## End(Not run)

mkoohafkan/arcpyrextra documentation built on May 23, 2019, 2:02 a.m.