Code
library(tidyverse)
::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE) knitr
Priya MArla
December 26, 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
.
[1] 2930 3
[1] "state" "county" "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
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).
[1] 53
[1] 1709
# A tibble: 1 × 1
`max(total_employees)`
<dbl>
1 8207
# A tibble: 1 × 1
`min(total_employees)`
<dbl>
1 1
# A tibble: 1 × 1
`mean(total_employees)`
<dbl>
1 87.2
By reading the data from “railroad_2012_clean_county.csv” dataset, I can see that this dataset describes the statistics of number of employees working in the different states and counties for the railroad in the year 2012. There are about 2930 rows and 3 columns where each row represents the total number of employees in each state and county. There a total of 53 states and 1709 counties. The maximum number of employee count recorded is 8207 and minimum count is 1. The average of total_employees in the entire dataset is 87.17816.
---
title: "Challenge 1"
author: "Priya MArla"
description: "Reading in data and creating a post"
date: "12/26/2022"
format:
html:
toc: true
code-fold: true
code-copy: true
code-tools: true
categories:
- challenge_1
---
```{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.xlsx ⭐⭐⭐⭐
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}
#loading the data from posts/_data folder
railroad <- read_csv("_data/railroad_2012_clean_county.csv")
#executed dim to know the dimentions i.e number of rows and columns of the dataset
dim(railroad)
```
```{r}
#executed colnames to get the column names in the dataset
colnames(railroad)
#executed head to get the first 5 rows of the dataset
head(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).
```{r}
#getting the distinct number of states and counties in the dataset
railroad%>%
select(state)%>%
n_distinct(.)
railroad%>%
select(county)%>%
n_distinct(.)
#maximum of total employees in the dataset
max_count <- summarise(railroad, max(total_employees))
max_count
#minimum of total employees in the dataset
min_count <- summarise(railroad, min(total_employees))
min_count
#mean of total employees in the dataset
mean_count <- summarise(railroad, mean(total_employees))
mean_count
```
By reading the data from "railroad_2012_clean_county.csv" dataset, I can see that this dataset describes the statistics of number of employees working in the different states and counties for the railroad in the year 2012. There are about 2930 rows and 3 columns where each row represents the total number of employees in each state and county. There a total of 53 states and 1709 counties. The maximum number of employee count recorded is 8207 and minimum count is 1. The average of total_employees in the entire dataset is 87.17816.