The csv file “animal_weights” contains the weight of 16 different animals (Cattle - dairy, Cattle - non-dairy, Buffaloes, Swine - market, Swine - breeding, Chicken - Broilers, Chicken - Layers, Ducks, Turkeys, Sheep, Goats, Horses, Asses, Mules, Camels, and Llamas) in 9 different areas of the world (Indian Subcontinent, Eastern Europe, Africa, Oceania,Western Europe,Latin America, Asia, Middle East and Northern America). This data was provided by the Intergovernmental Panel on Climate Change, a United Nations body assessing the science related to climate change.
This dataset can provide relevant information to determine underfeeding/overfeeding in certain areas of the world and check the measurements with the standards of the industry. It can also be useful in determining market values for the animals.
The dataset is wide and difficult to read. Therefore, I want to use the function pivot_longer() to make the data longer. However, I first want to check on what is the expected row/cases for the data.
# A tibble: 144 × 3
IPCC.Area Animals Weights
<chr> <chr> <dbl>
1 Indian Subcontinent Cattle...dairy 275
2 Indian Subcontinent Cattle...non.dairy 110
3 Indian Subcontinent Buffaloes 295
4 Indian Subcontinent Swine...market 28
5 Indian Subcontinent Swine...breeding 28
6 Indian Subcontinent Chicken...Broilers 0.9
7 Indian Subcontinent Chicken...Layers 1.8
8 Indian Subcontinent Ducks 2.7
9 Indian Subcontinent Turkeys 6.8
10 Indian Subcontinent Sheep 28
# … with 134 more rows
I first wanted to pivot the data longer to decrease the number of columns and create a couple of new columns called “Animals” and “Weights”. The first column “Animals”, contains the names of the animals. The second column, “Weights” contains the weight for each of the animals. Once I pivot my data, they were 144 observations and 3 variables.