# Example GeoJSON
geom <- '
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[174.1607666015625,-39.58452390500422],[173.79547119140625,-39.391631993791826],[173.80645751953125,-39.14497262511222],[174.35577392578125,-39.00211029922513],[174.57550048828125,-39.149232725827105],[174.66064453124997,-39.18117526158747],[174.47662353515625,-39.400122000145906],[174.30908203125,-39.54852980171145],[174.1607666015625,-39.58452390500422]]]}}]}
'
# Write to disk
fn <- tempfile()
write(geom, fn)
# Read GeoJSON
poly <- readOGR(dsn = fn, layer = 'OGRGeoJSON')
## OGR data source with driver: GeoJSON
## Source: "/tmp/Rtmp61dk1X/file10a63873259a", layer: "OGRGeoJSON"
## with 1 features
## It has 0 fields
# Quick plot
plot(poly)

# This a SpatialPolygonDataFrame
class(poly)
## [1] "SpatialPolygonsDataFrame"
## attr(,"package")
## [1] "sp"
# It already has an attribute
names(poly)
## [1] "FID"
# We can add another attribute
poly$id <- LETTERS[1:nrow(poly)]
poly@data
## FID id
## 0 0 A
spplot(poly)
## Warning in lapply(xd, as.numeric): NAs introduced by coercion
