team_5: Team 5 Function

Description Usage Arguments Details Value Examples

Description

Function based on the work by lab group 5 that converts a country shape file into a dataframe.

Usage

1
team_5(file, tolerance = 0.1)

Arguments

file

This is the shape file that will be converted to a datafarme. It can either be a file path in the form of a character string (ends in .shp) or a sf shape file object created using the sf package with a geometry type of multipolygon.

tolerance

This controls how much the shape file is thinned. The larger it is made the less detail the shape file will have. The tolerance is set to 0.1 by default.

Details

The variables included in the dataframe that is returned from team_5 are as follows.

Value

A dataframe created from the shape file. See the details for the variables included in the dataframe.

Examples

 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_5 function to convert the shape file to a dataframe
puerto_rico_df <- team_5(puerto_rico, 0.001)
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()

yaweige/lab3group3 documentation built on May 28, 2019, 12:23 p.m.