# NOT RUN {
library(RPostgreSQL)
con <- dbConnect(PostgreSQL(), dbname = "my_db")
# If geom column holds points, returns a SpatialPointsDataFrame
cities <- get_postgis_query(con, "SELECT name, geom, datalist FROM city",
geom_name = "geom", hstore_name = "datalist")
# Get the populations (part of datalist hstore) as a vector
pop <- cities@data$datalist %->% "population"
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab