Section 8.4 Cleaning Our Data
In Section 7.3 we had to clean our data because of the spaces in the column headers. Our current data has the same issue, as "Total Volume" and "Total Price" both have a space in them. Looks like the
clean_names() command will come in handy again like in Section 7.3. Let’s also do some other cleaning while we are at it.
library(janitor)
# Let's get rid of any spaces in the column names
pizza_sales<- clean_names(pizza_sales)
# We just want to see the relationship between volume and price, so week does not matter
pizza_sales<- pizza_sales |> select(-1)
# Let's rename our column names to make things easier
pizza_sales <- pizza_sales |>
rename(price = total_price, volume = total_volume)
We now have a cleaner dataset we can use!
