Homework 2
cols(
Product = col_character(), # string
Month = col_character(), # string
Year = col_double(), # numeric
Price_Dollar = col_double() # numeric
)
poultry %>%
arrange(desc(Price_Dollar)) %>%
select(Product, Price_Dollar) %>%
group_by(Product) %>%
slice(1) %>%
ungroup() %>%
arrange(desc(Price_Dollar))
# A tibble: 5 x 2
Product Price_Dollar
<chr> <dbl>
1 B/S Breast 7.04
2 Bone-in Breast 3.90
3 Whole 2.48
4 Thighs 2.22
5 Whole Legs 2.04
poultry %>%
arrange(Price_Dollar) %>%
select(Product, Month, Year, Price_Dollar) %>%
group_by(Product) %>%
slice(1)
# A tibble: 5 x 4
# Groups: Product [5]
Product Month Year Price_Dollar
<chr> <chr> <dbl> <dbl>
1 B/S Breast January 2012 6.38
2 Bone-in Breast January 2013 3.90
3 Thighs July 2004 2.00
4 Whole January 2004 1.98
5 Whole Legs January 2004 1.94
Text and figures are licensed under Creative Commons Attribution CC BY-NC 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".
For attribution, please cite this work as
Wheeler (2021, Dec. 28). Data Analytics and Computational Social Science: HW2. Retrieved from https://github.com/DACSS/dacss_course_website/posts/hw2/
BibTeX citation
@misc{wheeler2021hw2, author = {Wheeler, Adam}, title = {Data Analytics and Computational Social Science: HW2}, url = {https://github.com/DACSS/dacss_course_website/posts/hw2/}, year = {2021} }