Description Usage Arguments Value Examples
This function need a file path as an input to read the .shp file, and it will extract the geometry information to the top level.
1 |
file |
A path to the .shp file. Or a loaded sf shape file created using sf package with a geometry type of mutipolygon. If a loaded sf shape is supplied, the the tolerance is turned off. |
tolerance |
The value used to thin the data. |
A data.frame with the geometry information extracted to the top level. All other columns are kept. The new columns are as follows:
listno | The orginal rows that the expanded data coming from. |
long | Longitude. |
lat | Latitude. |
group | The group used to draw polygen. |
order | The order for the points within group. |
1 2 3 4 5 6 7 8 9 10 | # A shape file for Puerto Rico is already stored in the package
puerto_rico
# Use the team_1 function to convert the shape file to a dataframe
puerto_rico_df <- team_1(puerto_rico)
head(puerto_rico_df)
# Create a plot of Puerto Rico using the dataframe
library(ggplot2)
ggplot(puerto_rico_df, aes(x = long, y = lat, group = group)) + geom_polygon()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.