Overview

##             vars    n        mean           sd    median     trimmed
## Rank           1 5001     2501.64      1443.51 2.502e+03     2501.73
## Name*          2 5001     2501.00      1443.81 2.501e+03     2501.00
## Growth_Rate    3 5001        4.61        14.12 1.420e+00        2.14
## Revenue        4 5001 48222535.49 240542281.14 1.090e+07 17334966.26
## Industry*      5 5001       12.10         7.33 1.300e+01       12.05
## Employees      6 4989      232.72      1353.13 5.300e+01       81.78
## City*          7 5001      732.00       441.12 7.610e+02      731.74
## State*         8 5001       24.80        15.64 2.300e+01       24.44
##                     mad     min        max      range  skew kurtosis
## Rank            1853.25 1.0e+00 5.0000e+03 4.9990e+03  0.00    -1.20
## Name*           1853.25 1.0e+00 5.0010e+03 5.0000e+03  0.00    -1.20
## Growth_Rate        1.22 3.4e-01 4.2148e+02 4.2114e+02 12.55   242.34
## Revenue     10674720.00 2.0e+06 1.0100e+10 1.0098e+10 22.17   722.66
## Industry*          8.90 1.0e+00 2.5000e+01 2.4000e+01 -0.10    -1.18
## Employees         53.37 1.0e+00 6.6803e+04 6.6802e+04 29.81  1268.67
## City*            604.90 1.0e+00 1.5190e+03 1.5180e+03 -0.04    -1.26
## State*            19.27 1.0e+00 5.2000e+01 5.1000e+01  0.12    -1.46
##                     se
## Rank             20.41
## Name*            20.42
## Growth_Rate       0.20
## Revenue     3401441.44
## Industry*         0.10
## Employees        19.16
## City*             6.24
## State*            0.22
##             Growth_Rate     Revenue Employees
## Growth_Rate 1.000000000 0.006304135        NA
## Revenue     0.006304135 1.000000000        NA
## Employees            NA          NA         1

Questions

  • 12 values are missing in employee numbers, as directions want us to ignore those observations, I will drop them

Question 1

Create a graph that shows the distribution of companies in the dataset by State (ie how many are in each state). There are a lot of States, so consider which axis you should use. This visualization is ultimately going to be consumed on a ‘portrait’ oriented screen (ie taller than wide), which should further guide your layout choices.

First graph uses color graident to show total companies by state

Next I import google maps api log and lat data based on city data in dataframe and creates a ggpoint plot of all companies in america

Quick data check

##    Rank Name Growth_Rate Revenue Industry Employees City State state city
## 32 TRUE TRUE        TRUE    TRUE     TRUE      TRUE TRUE  TRUE  TRUE TRUE
##    geo_state  lon  lat
## 32     FALSE TRUE TRUE
## [1] 4989   13
## Source : https://maps.googleapis.com/maps/api/staticmap?center=united%20states&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx
## Source : https://maps.googleapis.com/maps/api/geocode/json?address=united+states&key=xxx
## Warning: Ignoring unknown aesthetics: show_guide

Next Approach uses simple bar plot

Next two approaches use dotplot and lollipop printed in reverse orders

Question 2

Lets dig in on the state with the 3rd most companies in the data set. Imagine you work for the state and are interested in how many people are employed by companies in different industries. Create a plot that shows the average and/or median employment by industry for companies in this state (only use cases with full data, use R’s complete.cases() function.) In addition to this, your graph should show how variable the ranges are, and you should deal with outliers.

Which State?

  • As seen below, NY is the state we will focus on
## # A tibble: 1 x 2
##   state count_per_state
##   <chr>           <int>
## 1 NY                311

Below I print several visualizations.

## NULL
## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.