HW 2 Submission - Organic Egg & Poultry Dataset CSV

Ayushe’s HW2 Submissions for DACSS 601

Ayushe Gangal
2022-03-16

Data Loading and Description

I have used the Organic Egg & Poultry data set which contains the Organic Egg & Poultry prices data in the US for 2004-2013. This dataset is of CSV format, and has been taken from the clean data sets given on the google classroom.

The code used and results are shown below. This is the table containing the Product, Year, Month and the prices of the products in dollars.

poultry <- read_csv("/Users/ayushe/RStudio stuff/RData/poultry_tidy.csv")
poultry
# A tibble: 600 × 4
   Product  Year Month     Price_Dollar
   <chr>   <dbl> <chr>            <dbl>
 1 Whole    2013 January           2.38
 2 Whole    2013 February          2.38
 3 Whole    2013 March             2.38
 4 Whole    2013 April             2.38
 5 Whole    2013 May               2.38
 6 Whole    2013 June              2.38
 7 Whole    2013 July              2.38
 8 Whole    2013 August            2.38
 9 Whole    2013 September         2.38
10 Whole    2013 October           2.38
# … with 590 more rows

Now we see the type of the values stored in the table using “specs()”. We also see the names of the columns in the data set, and see the types pf products in the table by using select(), and creating a table using table()

spec(poultry)
cols(
  Product = col_character(),
  Year = col_double(),
  Month = col_character(),
  Price_Dollar = col_double()
)
colnames(poultry)
[1] "Product"      "Year"         "Month"        "Price_Dollar"
product <- select(poultry, Product)
table(product)
product
    B/S Breast Bone-in Breast         Thighs          Whole 
           120            120            120            120 
    Whole Legs 
           120 

Dimensions of the data being used

dim(poultry)
[1] 600   4

Now we filter the product “Thighs” for the years “2013” and also print the price

Thighs_jan <- filter(poultry, `Product` == "Thighs", `Year` == "2013")
Thighs_jan
# A tibble: 12 × 4
   Product  Year Month     Price_Dollar
   <chr>   <dbl> <chr>            <dbl>
 1 Thighs   2013 January           2.16
 2 Thighs   2013 February          2.16
 3 Thighs   2013 March             2.16
 4 Thighs   2013 April             2.16
 5 Thighs   2013 May               2.16
 6 Thighs   2013 June              2.16
 7 Thighs   2013 July              2.16
 8 Thighs   2013 August            2.16
 9 Thighs   2013 September         2.16
10 Thighs   2013 October           2.16
11 Thighs   2013 November          2.16
12 Thighs   2013 December          2.16

Now we arrange the data from January 2013 in order of highest to lowest price for products which are not Thighs

poultry_jan <- filter(poultry, `Product` != "Thighs", `Year` == "2013", `Month` == "January")
poultry_jan_arrange <- arrange(poultry_jan, desc(Price_Dollar))
poultry_jan_arrange
# A tibble: 4 × 4
  Product         Year Month   Price_Dollar
  <chr>          <dbl> <chr>          <dbl>
1 B/S Breast      2013 January         7.04
2 Bone-in Breast  2013 January         3.90
3 Whole           2013 January         2.38
4 Whole Legs      2013 January         2.04

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

Gangal (2022, March 23). Data Analytics and Computational Social Science: HW 2 Submission - Organic Egg & Poultry Dataset CSV. Retrieved from https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomayushe17878836/

BibTeX citation

@misc{gangal2022hw,
  author = {Gangal, Ayushe},
  title = {Data Analytics and Computational Social Science: HW 2 Submission - Organic Egg & Poultry Dataset CSV},
  url = {https://github.com/DACSS/dacss_course_website/posts/httpsrpubscomayushe17878836/},
  year = {2022}
}