GridToMap: Grid to Map

Description Usage Arguments Author(s) Examples

Description

This function downloads Census county data and links each county to grid cells. The linking is area weighted to each grid.

Usage

1
2
3
4
GridToMap(method = "overlap", lon, lat, drop.states, keep.states,
  path = "LingGridToCountyCensusData", res = "500k", year = 2010,
  download = TRUE, proj4string = CRS("+proj=longlat +datum=wgs84"),
  grid.tolerace = 10^(-10), n.points = 1e+05)

Arguments

method

Method to map counties and grids. ‘Overlap’ (default) calculate the overlap in the area of each spacial polygon. ‘Points’ approximates the calculation by generating random points in each county and linking those to the nearest grid centroid. Points is more robust to invalid spatial polygons and irregularly spaced grid.

lon

A numeric vector of numeric longitudes for the centroids of each gridcell

lat

A numeric vector of numeric lattitudes for the centroids of each gridcell

drop.states

A character vector of two letter state abreviations to be dropped from the analysis.

keep.states

A list of states to keep.

path

A path to store data.

res

Resolution of the county files. The choices are ‘500k’ (default), ‘5m,’ and ‘20m’ which translate to 500k = 1:500,000, 5m = 1:5,000,000, and 20m = 1:20,000,000. This controls how precise the counties are defined.

year

The year of the county file. Default is 2010. They are available for each decenial census and 2013.

proj4string

A CRS class.

grid.tolerace

Grid tolerance used to make sure sure the grid is evenly spaced. Default is 10^10. For overlap method only.

n.points

Number of points generated in each county for points method. The large the number the more precise but slower it will be

dataframe

A logical with TRUE indicating to return a dataframe of shapes and FALSE (default) indicating to return an object of class SpatialPolygons

Author(s)

Ander Wilson

Examples

1
2
3
4
data(GridToMapSampleData)
lon <- GridToMapSampleData$names$lon
lat <- GridToMapSampleData$names$lat
ma.overlap<- GridToMap(lon=lon, lat=lat, method="overlap",keep.states=c("MA"))

AnderWilson/GridToMaps documentation built on May 5, 2019, 4:56 a.m.