Hello all,
I am currently working with a dataset of 170 countries, between the years of 1990-2021. The key variable which I am analysing is the supply of certain types of foods. Currently I have the data such that all individual food items are in one column. My goal is to create separate variables which are the summation of several different items of food. e.g., Meat = Bovine Meat + Meat, Other or Fruits = Grapes and products + Apples and products etc., such that I have one value per year and country for supply of meats and of fruits.
Is this possible? If so, with what code could this be accomplished?
I included a picture of what my current dataset looks like so you may better understand what I am trying to bring across with my limited programming knowledge.

My sincerest thanks in advance!
Nuni B
I am currently working with a dataset of 170 countries, between the years of 1990-2021. The key variable which I am analysing is the supply of certain types of foods. Currently I have the data such that all individual food items are in one column. My goal is to create separate variables which are the summation of several different items of food. e.g., Meat = Bovine Meat + Meat, Other or Fruits = Grapes and products + Apples and products etc., such that I have one value per year and country for supply of meats and of fruits.
Is this possible? If so, with what code could this be accomplished?
I included a picture of what my current dataset looks like so you may better understand what I am trying to bring across with my limited programming knowledge.
My sincerest thanks in advance!
Nuni B

Comment