spdf_to_df: Convert county SpatialPolygonsDataFrame to a tidy data frame.

Description Usage Arguments Value Examples

View source: R/00-misc.R

Description

spdf_to_df converts a SpatialPolygonsDataFrame object returned from the pull_spdf function to a data frame.

Usage

1
spdf_to_df(spdf)

Arguments

spdf

A SpatialPolygonsDataFrame object returned from the pull_spdf function.

Value

A data frame with 24 columns if the spdf object is on the section level and 23 columns if the spdf object is on the township level.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(magrittr)

df <- readRDS(system.file("extdata", "fresno_spdf.rds", package = "purexposure")) 
   spdf_to_df()

df <- pull_spdf("frenso") 
df2 <- pull_spdf("sonoma") 
# use df_plot() function to easily plot the output data frames:
df_plot(df)
df_plot(df2)

leighseverson/purexposure documentation built on Aug. 13, 2021, 6:34 p.m.