Homework 2 : Samhith Barlaya

Submission for Homework 2

Samhith Barlaya
2021-12-29

1. Read in a dataset

For this homework, I read in the poultry_tidy dataset. A glimpse of the dataset, obtained using head() method can be found below:

library("readxl")
poultry_data <- read_excel(path="C:/Users/gbsam/Desktop/poultry_tidy.xlsx")
head(poultry_data)
# A tibble: 6 x 4
  Product  Year Month    Price_Dollar
  <chr>   <dbl> <chr>    <chr>       
1 Whole    2013 January  2.385       
2 Whole    2013 February 2.385       
3 Whole    2013 March    2.385       
4 Whole    2013 April    2.385       
5 Whole    2013 May      2.385       
6 Whole    2013 June     2.385       

2. Explain the variables in your dataset

There are 4 variables in this data set. The columns Product, Month and Price_Dollars are character strings, and column year is double precision floating point number.

3. Perform atleast 2 basic data-wrangling operations.

I filter out the poultry items that are less that 3 dollars in price sold in month January. And then arrange them by ascending order of year sold.

library("dplyr")
filter(poultry_data, Price_Dollar >= 3 & Month == "January") %>%
  arrange(Year)
# A tibble: 21 x 4
   Product         Year Month   Price_Dollar
   <chr>          <dbl> <chr>   <chr>       
 1 B/S Breast      2004 January 6.455       
 2 Bone-in Breast  2004 January NA          
 3 Thighs          2004 January NA          
 4 B/S Breast      2005 January 6.44        
 5 Bone-in Breast  2005 January 3.905       
 6 B/S Breast      2006 January 6.455       
 7 Bone-in Breast  2006 January 3.905       
 8 B/S Breast      2007 January 6.455       
 9 Bone-in Breast  2007 January 3.905       
10 B/S Breast      2008 January 6.455       
# ... with 11 more rows

Reuse

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 ...".

Citation

For attribution, please cite this work as

Barlaya (2021, Dec. 30). Data Analytics and Computational Social Science: Homework 2 : Samhith Barlaya. Retrieved from https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomsbarlaya851735/

BibTeX citation

@misc{barlaya2021homework,
  author = {Barlaya, Samhith},
  title = {Data Analytics and Computational Social Science: Homework 2 : Samhith Barlaya},
  url = {https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomsbarlaya851735/},
  year = {2021}
}