Attaching package: 'lubridate'
The following objects are masked from 'package:base':
date, intersect, setdiff, union
library(stringr)
##Read in data
poultry<-read_csv("_data/poultry_tidy.csv")
Rows: 600 Columns: 4
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (2): Product, Month
dbl (2): Year, Price_Dollar
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(poultry)
The dataset poultry contains information related to the price per month of poultry cuts from 2004 - 2013. The dataset contains 600 observations and 4 different variables. The variables for this dataset are: -Product: This variable contains different poultry cuts including whole, breast, boneless breast, bone-in breast, whole legs, and thighs. -Year and month: These variables contain the month and the year for each poultry cut price. Price_dollar: The dollar amount per month for each poultry cut.
The first step I want to do to clean the data is to combine the month and the year to reduce the number of columns. Next, I would like to use the mutate_if function to have 2 decimals for the price of the cuts.
##Combine year and month to reduce number of columns