# A tibble: 904 × 10
Year Month Day Federal F…¹ Feder…² Feder…³ Effec…⁴ Real …⁵ Unemp…⁶ Infla…⁷
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1954 7 1 NA NA NA 0.8 4.6 5.8 NA
2 1954 8 1 NA NA NA 1.22 NA 6 NA
3 1954 9 1 NA NA NA 1.06 NA 6.1 NA
4 1954 10 1 NA NA NA 0.85 8 5.7 NA
5 1954 11 1 NA NA NA 0.83 NA 5.3 NA
6 1954 12 1 NA NA NA 1.28 NA 5 NA
7 1955 1 1 NA NA NA 1.39 11.9 4.9 NA
8 1955 2 1 NA NA NA 1.29 NA 4.7 NA
9 1955 3 1 NA NA NA 1.35 NA 4.6 NA
10 1955 4 1 NA NA NA 1.43 6.7 4.7 NA
# … with 894 more rows, and abbreviated variable names
# ¹`Federal Funds Target Rate`, ²`Federal Funds Upper Target`,
# ³`Federal Funds Lower Target`, ⁴`Effective Federal Funds Rate`,
# ⁵`Real GDP (Percent Change)`, ⁶`Unemployment Rate`, ⁷`Inflation Rate`
# ℹ Use `print(n = ...)` to see more rows
Generated by summarytools 1.0.1 (R version 4.2.1) 2022-09-04
Code
str(feds)
spec_tbl_df [904 × 10] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ Year : num [1:904] 1954 1954 1954 1954 1954 ...
$ Month : num [1:904] 7 8 9 10 11 12 1 2 3 4 ...
$ Day : num [1:904] 1 1 1 1 1 1 1 1 1 1 ...
$ Federal Funds Target Rate : num [1:904] NA NA NA NA NA NA NA NA NA NA ...
$ Federal Funds Upper Target : num [1:904] NA NA NA NA NA NA NA NA NA NA ...
$ Federal Funds Lower Target : num [1:904] NA NA NA NA NA NA NA NA NA NA ...
$ Effective Federal Funds Rate: num [1:904] 0.8 1.22 1.06 0.85 0.83 1.28 1.39 1.29 1.35 1.43 ...
$ Real GDP (Percent Change) : num [1:904] 4.6 NA NA 8 NA NA 11.9 NA NA 6.7 ...
$ Unemployment Rate : num [1:904] 5.8 6 6.1 5.7 5.3 5 4.9 4.7 4.6 4.7 ...
$ Inflation Rate : num [1:904] NA NA NA NA NA NA NA NA NA NA ...
- attr(*, "spec")=
.. cols(
.. Year = col_double(),
.. Month = col_double(),
.. Day = col_double(),
.. `Federal Funds Target Rate` = col_double(),
.. `Federal Funds Upper Target` = col_double(),
.. `Federal Funds Lower Target` = col_double(),
.. `Effective Federal Funds Rate` = col_double(),
.. `Real GDP (Percent Change)` = col_double(),
.. `Unemployment Rate` = col_double(),
.. `Inflation Rate` = col_double()
.. )
- attr(*, "problems")=<externalptr>
---title: "Challenge 4"author: "Adithya Parupudi"desription: "More data wrangling: pivoting"date: "08/18/2022"format: html: toc: true code-fold: true code-copy: true code-tools: truecategories: - challenge_4 - Adithya Parupudi---```{r}#| label: setup#| warning: false#| message: falselibrary(tidyverse)knitr::opts_chunk$set(echo =TRUE, warning=FALSE, message=FALSE)```## Read in data```{r}feds<-read_csv("_data/FedFundsRate.csv",show_col_types =FALSE)feds```### Briefly describe the data```{r}colnames(feds)```All are numeric columns and the last columns have NA values.```{r}print(summarytools::dfSummary(feds,varnumbers =FALSE,plain.ascii =FALSE, style ="grid", graph.magnif =0.70, valid.col =FALSE),method ='render',table.classes ='table-condensed')``````{r}str(feds)```## Tidy Data (as needed)replacing NA with 0```{r}feds<- feds %>%replace_na(list(`Federal Funds Target Rate`=0, `Federal Funds Upper Target`=0, `Federal Funds Lower Target`=0, `Inflation Rate`=0, `Real GDP (Percent Change)`=0,`Unemployment Rate`=0,`Effective Federal Funds Rate`=0))```checking for comments at EOF```{r}tail(feds)```## Identify variables that need to be mutatedRenaming column names as they are too long```{r}colnames(feds)``````{r}feds<-feds %>%rename("TargetRate"=`Federal Funds Target Rate`, "UpperTarget"=`Federal Funds Upper Target`, "EffectiveRate"=`Effective Federal Funds Rate`,"GDP%Change"=`Real GDP (Percent Change)`,"InflationRate"=`Inflation Rate`)feds```