# NOT RUN {
# set table of a geom
# individual attributes per point/line/polygon feature
getTable(gtGeoms$point)
newAttr <- setTable(x = gtGeoms$point,
slot = "point",
table = data.frame(attr = letters[c(1:12)]))
getTable(x = newAttr, slot = "point")
newAttr2 <- setTable(x = newAttr,
slot = "feature",
table = data.frame(gid = c(1:3), attr = letters[1:3]))
getTable(x = newAttr2, slot = "feature")
newAttr2
# set table of an Spatial object
spObj <- gtSP$SpatialPolygonsDataFrame
# ... with common columns
myAttributes <- data.frame(a = c(2, 1), attr = letters[1:2])
setTable(x = spObj, table = myAttributes)
# ... without common columns
setTable(x = spObj, table = myAttributes[2])
# set table of an sf
sfObj <- gtSF$polygon
# ... with common columns
myAttributes <- data.frame(a = c(2, 1), attr = letters[1:2])
setTable(x = sfObj, table = myAttributes)
# ... without common columns
setTable(x = sfObj, table = myAttributes[2])
# set table to an sfc (no join possible) and transform it to sf thereby
sfcObj = gtSF$polygon$geometry
setTable(x = sfcObj, table = myAttributes)
table <- data.frame(attr = LETTERS[1:15],
colour = topo.colors(15))
setTable(gtPPP, table = table)
# }
Run the code above in your browser using DataLab