Hello there,
I am encountering a problem reshaping my data and I would greatly appreciate your help.
I have the following dataset:
ObjectId c_id Country s_id Variable yr2013 yr2014 yr2015 yr2016 yr2017 yr2018 yr2019 yr2020 yr2021 yr2022
1 1 Afghanistan, Islamic Rep. of 1 Climate-Driven Hazard & Exposure 6.3 6.3 6.3 6.3 6.3 6.3 6.3 6.3 6.5 6.5
189 48 Dominican Rep. 2 Climate-Driven Inform Risk Indicator 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1
409 103 Mali 3 Index for Risk Management; Lack of Coping Capacity 5.4 5.4 5.4 5.4 5.4 5.4 5.4 5.4 5.5 5.5
718 182 Uruguay 4 Index for Risk Management; Vulnerability 2.1 2.2 2.1 2.2 2.3 2.3 1.9 2.4 2.4
Where s_id is the code for each variable
I would like to reshape this data to look like this:
ObjectId c_id Country year 1 2 3 4
1 1 Afghanistan, Islamic Rep. of 2013 6.3
1 1 Afghanistan, Islamic Rep. of 2014 6.3
1 1 Afghanistan, Islamic Rep. of 2015 6.3
1 1 Afghanistan, Islamic Rep. of 2016 6.3
1 1 Afghanistan, Islamic Rep. of 2017 6.3
1 1 Afghanistan, Islamic Rep. of 2018 6.3
1 1 Afghanistan, Islamic Rep. of 2019 6.3
1 1 Afghanistan, Islamic Rep. of 2020 6.3
1 1 Afghanistan, Islamic Rep. of 2021 6.5
1 1 Afghanistan, Islamic Rep. of 2022 6.5
& so on, do you know how I can do so ?
Thank you in advance!
I am encountering a problem reshaping my data and I would greatly appreciate your help.
I have the following dataset:
ObjectId c_id Country s_id Variable yr2013 yr2014 yr2015 yr2016 yr2017 yr2018 yr2019 yr2020 yr2021 yr2022
1 1 Afghanistan, Islamic Rep. of 1 Climate-Driven Hazard & Exposure 6.3 6.3 6.3 6.3 6.3 6.3 6.3 6.3 6.5 6.5
189 48 Dominican Rep. 2 Climate-Driven Inform Risk Indicator 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1 5.1
409 103 Mali 3 Index for Risk Management; Lack of Coping Capacity 5.4 5.4 5.4 5.4 5.4 5.4 5.4 5.4 5.5 5.5
718 182 Uruguay 4 Index for Risk Management; Vulnerability 2.1 2.2 2.1 2.2 2.3 2.3 1.9 2.4 2.4
Where s_id is the code for each variable
I would like to reshape this data to look like this:
ObjectId c_id Country year 1 2 3 4
1 1 Afghanistan, Islamic Rep. of 2013 6.3
1 1 Afghanistan, Islamic Rep. of 2014 6.3
1 1 Afghanistan, Islamic Rep. of 2015 6.3
1 1 Afghanistan, Islamic Rep. of 2016 6.3
1 1 Afghanistan, Islamic Rep. of 2017 6.3
1 1 Afghanistan, Islamic Rep. of 2018 6.3
1 1 Afghanistan, Islamic Rep. of 2019 6.3
1 1 Afghanistan, Islamic Rep. of 2020 6.3
1 1 Afghanistan, Islamic Rep. of 2021 6.5
1 1 Afghanistan, Islamic Rep. of 2022 6.5
& so on, do you know how I can do so ?
Thank you in advance!
Comment