Challenge_4

Author

Jyoti Rani

Published

August 22, 2022

Briefly describe the data

poultry_tidy<-read_csv("_data/poultry_tidy.csv",
                        show_col_types = FALSE)

Tidy Data

In our data each value has its own column. However, the year column seems to be backwards, and the price values don’t round up to two digits.

Identify variables that need to be mutated

Are there any variables that require mutation to be usable in your analysis stream? For example, are all time variables correctly coded as dates? Are all string variables reduced and cleaned to sensible categories? Do you need to turn any variables into factors and reorder for ease of graphics and visualization?

Document your work here.

poultry_tidy %>%
  arrange(Product, Year) %>%
  mutate_at(vars(Price_Dollar), funs(round(., digit = 2)))
Warning: `funs()` was deprecated in dplyr 0.8.0.
ℹ Please use a list of either functions or lambdas:

# Simple named list: list(mean = mean, median = median)

# Auto named with `tibble::lst()`: tibble::lst(mean, median)

# Using lambdas list(~ mean(., trim = .2), ~ median(., na.rm = TRUE))
# A tibble: 600 × 4
   Product     Year Month     Price_Dollar
   <chr>      <dbl> <chr>            <dbl>
 1 B/S Breast  2004 January           6.46
 2 B/S Breast  2004 February          6.42
 3 B/S Breast  2004 March             6.42
 4 B/S Breast  2004 April             6.42
 5 B/S Breast  2004 May               6.42
 6 B/S Breast  2004 June              6.41
 7 B/S Breast  2004 July              6.42
 8 B/S Breast  2004 August            6.42
 9 B/S Breast  2004 September         6.42
10 B/S Breast  2004 October           6.42
# … with 590 more rows