Challenge 4 Instructions

challenge_4
Author

Yakub Rabiutheen

Published

August 18, 2022

Code
library(tidyverse)

knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)

Challenge Overview

Today’s challenge is to:

  1. read in a data set, and describe the data set using both words and any supporting information (e.g., tables, etc)
  2. tidy data (as needed, including sanity checks)
  3. identify variables that need to be mutated
  4. mutate variables and sanity check all mutations

Read in data

Read in one (or more) of the following datasets, using the correct R package and command.

  • abc_poll.csv ⭐
  • poultry_tidy.csv⭐⭐
  • FedFundsRate.csv⭐⭐⭐
  • hotel_bookings.csv⭐⭐⭐⭐
  • debt_in_trillions ⭐⭐⭐⭐⭐

Column Names

Code
colnames(abc_poll_2021)
Error in is.data.frame(x): object 'abc_poll_2021' not found

Briefly describe the data

Tidy Data (as needed)

This Data is already tidy, perhaps I will compare data about education and Political Identification.

It is also interesting to note that there seems to be a high frequency of working full-time and having a Bachelors degree.

Code
table(abc_poll_2021$ppeducat,abc_poll_2021$ppemploy)
Error in table(abc_poll_2021$ppeducat, abc_poll_2021$ppemploy): object 'abc_poll_2021' not found

Cleaned Up Party id similar to how Meredith did it. Removed all Skipped answers and Removed the An.

Code
abc_poll_2021<-abc_poll_2011%>%
  mutate(partyid = str_remove(QPID, "A[n]* "),
         partyid = na_if(partyid, "Skipped"))%>%
  select(-QPID)
Error in mutate(., partyid = str_remove(QPID, "A[n]* "), partyid = na_if(partyid, : object 'abc_poll_2011' not found
Code
table(abc_poll_2021$QID)
Error in table(abc_poll_2021$QID): object 'abc_poll_2021' not found

Table below demonstrates the general trend that Democrats are more likely to have a Bachelor’s Degree or Higher

Code
table(abc_poll_2021$partyid,abc_poll_2021$ppeducat)
Error in table(abc_poll_2021$partyid, abc_poll_2021$ppeducat): object 'abc_poll_2021' not found





:::{#quarto-navigation-envelope .hidden}
[Challenge 4 Instructions]{.hidden render-id="quarto-int-sidebar-title"}
[Challenge 4 Instructions]{.hidden render-id="quarto-int-navbar-title"}
[August 2022 Posts]{.hidden render-id="quarto-int-navbar:August 2022 Posts"}
[Featured Posts]{.hidden render-id="quarto-int-navbar:Featured Posts"}
[Contributors]{.hidden render-id="quarto-int-navbar:Contributors"}
[DACSS]{.hidden render-id="quarto-int-navbar:DACSS"}
:::



:::{#quarto-meta-markdown .hidden}
[ - Challenge 4 Instructions]{.hidden render-id="quarto-metatitle"}
:::




<!-- -->

::: {.quarto-embedded-source-code}
```````````````````{.markdown shortcodes="false"}
---
title: "Challenge 4 Instructions"
author: "Yakub Rabiutheen"
desription: "More data wrangling: pivoting"
date: "08/18/2022"
format:
  html:
    toc: true
    code-fold: true
    code-copy: true
    code-tools: true
categories:
  - challenge_4
---

quarto-executable-code-5450563D

```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 data set, and describe the data set using both words and any supporting information (e.g., tables, etc)
  2. tidy data (as needed, including sanity checks)
  3. identify variables that need to be mutated
  4. mutate variables and sanity check all mutations

Read in data

Read in one (or more) of the following datasets, using the correct R package and command.

  • abc_poll.csv ⭐
  • poultry_tidy.csv⭐⭐
  • FedFundsRate.csv⭐⭐⭐
  • hotel_bookings.csv⭐⭐⭐⭐
  • debt_in_trillions ⭐⭐⭐⭐⭐

Column Names

quarto-executable-code-5450563D

colnames(abc_poll_2021)

Briefly describe the data

Tidy Data (as needed)

This Data is already tidy, perhaps I will compare data about education and Political Identification.

It is also interesting to note that there seems to be a high frequency of working full-time and having a Bachelors degree.

quarto-executable-code-5450563D

table(abc_poll_2021$ppeducat,abc_poll_2021$ppemploy)

Cleaned Up Party id similar to how Meredith did it. Removed all Skipped answers and Removed the An.

quarto-executable-code-5450563D

abc_poll_2021<-abc_poll_2011%>%
  mutate(partyid = str_remove(QPID, "A[n]* "),
         partyid = na_if(partyid, "Skipped"))%>%
  select(-QPID)
table(abc_poll_2021$QID)

Table below demonstrates the general trend that Democrats are more likely to have a Bachelor’s Degree or Higher

quarto-executable-code-5450563D

table(abc_poll_2021$partyid,abc_poll_2021$ppeducat)

:::