draw_state: Map a state's registered companies

Description Usage Arguments Details Value Note Author(s) Examples

Description

Displays a map of a state, showing registered companies clustered by the business zipcode, sized by the amount per zip code, and color-coded by the company's primary industry.

Usage

1
draw_state(x, state_input = "", savemap = FALSE)

Arguments

x

A data frame of addresses in the SEC's format

state_input

Uppercase 2-character state code. If this is not provided, the function will prompt for a state.

savemap

file name of the saved map in .png format. If this is not provided, the function will draw the map on the screen, but not save it to a file.

Details

This function will prompt for a 2-letter uppercase state name (if there isn't one passed in), then use the data frame's geographic data (latitude and longitude based on the business zip code) to map the locations of registered companies in that state. The map data is shown by size of data point (based on the amount of companies in a given area), and color-coded by the industry that it is in. If no state is entered, Virginia (VA) is assumed. If no records are found for a given state, an error message is printed.

Value

A registered company map of the selected state

Note

This function makes use of the ggmap package. The base SEC address file doesn't contain any geographical data. This means that before running this routine, create "Lat" and "Long" columns, and create a 'companies' column that contains a count of companies per zip code. The routine 'add_geodata' can perform this function for you.

Author(s)

Nick Lukianoff

Examples

1
2
3
draw_state(df)
draw_state(df,"DE")
draw_state(df,"DE","Delaware Companies")

NickSEC/SECAddresses documentation built on May 7, 2019, 6:07 p.m.