Code
library(tidyverse)
::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE) knitr
Tenzin Latoe
June 20, 2023
Today’s challenge is to
read in a dataset, and
describe the dataset using both words and any supporting information (e.g., tables, etc)
The data consists of 2930 rows and 3 columns, which represent State, county, and total employees.
# A tibble: 6 × 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
Head function used to preview the first 5 rows of the dataframe
# A tibble: 12 × 3
state county total_employees
<chr> <chr> <dbl>
1 MA BARNSTABLE 44
2 MA BERKSHIRE 50
3 MA BRISTOL 232
4 MA ESSEX 314
5 MA FRANKLIN 113
6 MA HAMPDEN 202
7 MA HAMPSHIRE 68
8 MA MIDDLESEX 673
9 MA NORFOLK 386
10 MA PLYMOUTH 429
11 MA SUFFOLK 558
12 MA WORCESTER 310
To specifically at MA, we can can filter the data by searching specific states. I selected MA from the current railroad dataset.
---
title: "Challenge 1 Solutions"
author: "Tenzin Latoe"
description: "Reading in data and creating a post"
date: "07/04/2023"
format:
html:
toc: true
code-fold: true
code-copy: true
code-tools: true
categories:
- challenge_1
- Tenzin Latoe
- railroads
---
```{r}
#| label: setup
#| warning: false
#| message: false
library(tidyverse)
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
- railroad_2012_clean_county.csv ⭐
```{r}
railroad <- read_csv("_data/railroad_2012_clean_county.csv")
```
```{r}
railroad
```
## Describe the data
The data consists of 2930 rows and 3 columns, which represent State, county, and total employees.
```{r}
#Preview: railroad
head(railroad)
```
Head function used to preview the first 5 rows of the dataframe
```{r}
colnames(railroad)
```
```{r}
#Filter Massachusetts from railroad
filter(railroad, `state` == "MA")
```
To look specifically at MA, we can can filter the data by searching specific states. I selected MA from the current railroad dataset.