Code
library(tidyverse)
::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE) knitr
Prachiti Parkar
February 22, 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)
Read in one (or more) of the following data sets, using the correct R package and command.
Find the _data
folder, located inside the posts
folder. Then you can read in the data, using either one of the readr
standard tidy read commands, or a specialized package such as readxl
.
# 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
[1] "Total number of rows are "
[1] 2930
Add any comments or documentation as needed. More challenging data sets may require additional code chunks and documentation.
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).
The data consists of 3 columns namely, the state, county and the count of the total employees working in a particular county of a particular state and 2930 rows. The data must have been likely gathered by cumulating information from all county of all states.
[1] 2930 3
[1] "state" "county" "total_employees"
# A tibble: 1 × 3
state county total_employees
<chr> <chr> <dbl>
1 AE APO 2
# A tibble: 1,484 × 3
state county total_employees
<chr> <chr> <dbl>
1 AK SKAGWAY MUNICIPALITY 88
2 AL BIBB 25
3 AL BULLOCK 13
4 AL BUTLER 29
5 AL CALHOUN 45
6 AL CHAMBERS 13
7 AL CHILTON 72
8 AL CLARKE 26
9 AL CLAY 10
10 AL COFFEE 14
# … with 1,474 more rows
---
title: "Challenge 1 Solution - Railroads"
author: "Prachiti Parkar"
desription: "Reading in data and creating a post"
date: "02/22/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)
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
Read in one (or more) of the following data sets, using the correct R package and command.
- railroad_2012_clean_county.csv ⭐
- birds.csv ⭐⭐
- FAOstat\*.csv ⭐⭐
- wild_bird_data.xlsx ⭐⭐⭐
- StateCounty2012.xls ⭐⭐⭐⭐
Find the `_data` folder, located inside the `posts` folder. Then you can read in the data, using either one of the `readr` standard tidy read commands, or a specialized package such as `readxl`.
```{r}
library(readr)
railroad <- read_csv("_data/railroad_2012_clean_county.csv")
view(railroad)
# first few rows of the dataset
head(railroad)
print("Total number of rows are ")
nrow(railroad)
```
Add any comments or documentation as needed. More challenging data sets may require additional code chunks and documentation.
## 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).
The data consists of 3 columns namely, the state, county and the count of the total employees working in a particular county of a particular state and 2930 rows. The data must have been likely gathered by cumulating information from all county of all states.
```{r}
#| label: summary
dim(railroad)
# Identifying the column names of the dataset
colnames(railroad)
#Filter state AE from the dataset
filter(railroad, state == "AE")
#Filter the rows that has total_employees between 10 and 100 inclusive
filter(railroad, `total_employees` >= 10 & `total_employees` <= 100)
```