#Read the first datasetcattle<-here("posts", "_data", "FAOSTAT_cattle_dairy.csv")%>%read_csv()
Rows: 36449 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): Domain Code, Domain, Area, Element, Item, Unit, Flag, Flag Description
dbl (6): Area Code, Element Code, Item Code, Year Code, Year, Value
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Read second dataset chicken<-here("posts", "_data", "FAOSTAT_egg_chicken.csv")%>%read_csv()
Rows: 38170 Columns: 14
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (8): Domain Code, Domain, Area, Element, Item, Unit, Flag, Flag Description
dbl (6): Area Code, Element Code, Item Code, Year Code, Year, Value
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
For this challenge, I’ll be joining two sets of data. Both sets of data are provided by the Food and Agriculture Organization of the United Nations. The first set, cattle, represent the vaues of livestock (Milk Animals, Yield, or Production) in different areas of the world over the years. Other variables include unit, flag, flag description, and different codes.
The second set of data that I’ll be joining, chicken, contains values of chickens (Laying, Yield, or Production) in different areas of the world over the years.
#Join both datasets joined<-bind_rows(cattle, chicken)print(joined)
I’m using the bind_rows function since both datasets have the same variables. As I result, my new dataset called joined has 74619 observations and 14 variables.