Code
library(tidyverse)
library(readr)
::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE) knitr
Kimberly Darkenwald
October 12, 2022
Today’s challenge is to
read in a dataset, and
describe the dataset using both words and any supporting information (e.g., tables, etc)
# A tibble: 2,930 × 3
state county total_employees
<chr> <chr> <dbl>
1 AE APO 2
2 AK ANCHORAGE 7
3 AK FAIRBANKS NORTH STAR 2
4 AK JUNEAU 3
5 AK MATANUSKA-SUSITNA 2
6 AK SITKA 1
7 AK SKAGWAY MUNICIPALITY 88
8 AL AUTAUGA 102
9 AL BALDWIN 143
10 AL BARBOUR 1
# … with 2,920 more rows
Using a combination of words and results of R commands, can you provide a high level description of the data? Describe as efficiently as possible where/how the data was (likely) gathered, indicate the cases and variables (both the interpretation and any details you deem useful to the reader to fully understand your chosen data).
There are a total of 3 variables: state, county, and employees. There are a total 2930 cases.
*How do I find the duplicated states?
# A tibble: 10 × 3
state county total_employees
<chr> <chr> <dbl>
1 IL COOK 8207
2 TX TARRANT 4235
3 NE DOUGLAS 3797
4 NY SUFFOLK 3685
5 VA INDEPENDENT CITY 3249
6 FL DUVAL 3073
7 CA SAN BERNARDINO 2888
8 CA LOS ANGELES 2545
9 TX HARRIS 2535
10 NE LINCOLN 2289
# A tibble: 145 × 3
state county total_employees
<chr> <chr> <dbl>
1 AK SITKA 1
2 AL BARBOUR 1
3 AL HENRY 1
4 AP APO 1
5 AR NEWTON 1
6 CA MONO 1
7 CO BENT 1
8 CO CHEYENNE 1
9 CO COSTILLA 1
10 CO DOLORES 1
# … with 135 more rows
# A tibble: 145 × 3
# Groups: state [34]
state county total_employees
<chr> <chr> <dbl>
1 AK SITKA 1
2 AL BARBOUR 1
3 AL HENRY 1
4 AP APO 1
5 AR NEWTON 1
6 CA MONO 1
7 CO BENT 1
8 CO CHEYENNE 1
9 CO COSTILLA 1
10 CO DOLORES 1
# … with 135 more rows
As indicated by the dataset, seven states in the country contain the top 10 counties with the highest amount of railroad employees. These states include Illinois, Texas, Nebrasaka, New York, Virginia, Florida, and California. Cook county in Illinois contains the most employees totaling 8,207. There are 145 counties with only 1 railraod employee. Those employees are very lonely when they go to work.
*How do I group the states?
---
title: "Challenge 1 Instructions"
author: "Kimberly Darkenwald"
desription: "Reading in data and creating a post"
date: "10/12/2022"
format:
html:
toc: true
code-fold: true
code-copy: true
code-tools: true
categories:
- challenge_1
- railroads
- faostat
- wildbirds
---
```{r}
#| label: setup
#| warning: false
#| message: false
library(tidyverse)
library(readr)
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)
```
## Challenge Overview
Today's challenge is to
1) read in a dataset, and
2) describe the dataset using both words and any supporting information (e.g., tables, etc)
## Read in the Data
```{r}
railroad <- read_csv("_data/railroad_2012_clean_county.csv")
railroad
```
## Describe the data
Using a combination of words and results of R commands, can you provide a high level description of the data? Describe as efficiently as possible where/how the data was (likely) gathered, indicate the cases and variables (both the interpretation and any details you deem useful to the reader to fully understand your chosen data).
```{r}
#| label: summary
colnames(railroad)
dim(railroad)
```
There are a total of 3 variables: state, county, and employees. There are a total 2930 cases.
*How do I find the duplicated states?
```{r}
#| label: summary 2
arrange(railroad,desc(total_employees)) %>%
slice(1:10)
filter(railroad, total_employees == 1)
filter(railroad, total_employees == 1) %>%
group_by(state)
```
As indicated by the dataset, seven states in the country contain the top 10 counties with the highest amount of railroad employees. These states include Illinois, Texas, Nebrasaka, New York, Virginia, Florida, and California. Cook county in Illinois contains the most employees totaling 8,207. There are 145 counties with only 1 railraod employee. Those employees are very lonely when they go to work.
*How do I group the states?