I have this data set:
rawdata = {{"time", "region", "subregion", "status", "country",
"indicator", "data"}, {2000.`, "Africa", "Central Africa", "LDC",
"Angola", "Remittances", 0.0267993914860461`}, {2000.`, "Africa",
"Central Africa", "LDC", "Angola", "ODA",
4.05719895987582`}, {2000.`, "Asia", "South Asia", "ODC",
"Bhutan", "Tax revenues", 12.9794732034214`}, {2000.`, "Asia",
"South Asia", "ODC", "Bhutan", "Gross domestic savings",
27.3167848363906`}, {2000.`, "Asia", "South Asia", "ODC",
"Bhutan", "Adjusted net savings", 44.1909199162357`}, {2000.`,
"Asia", "SIDS", "LDC", "Solomon Islands",
"Gross domestic savings", 0.221702694892883`}, {2000.`, "Asia",
"SIDS", "LDC", "Kiribati", "Adjusted net savings", 7.9`}, {2001.`,
"Africa", "Central Africa", "LDC", "Angola", "Remittances",
0.0212549938881954`}, {2001.`, "Africa", "Central Africa", "LDC",
"Angola", "ODA", 3.83358753594609`}, {2001.`, "Asia",
"South Asia", "ODC", "Bhutan", "Tax revenues",
12.5415621434496`}, {2001.`, "Asia", "South Asia", "ODC",
"Bhutan", "Gross domestic savings", 37.1804901737896`}, {2001.`,
"Asia", "South Asia", "ODC", "Bhutan", "Broadband subscriptions",
0.497992844`}, {2001.`, "Asia", "SIDS", "LDC", "Solomon Islands",
"Tax revenues", 4.7808499936`}, {2001.`, "Asia", "SIDS", "LDC",
"Solomon Islands", "Gross domestic savings",
0.38613349199295`}, {2001.`, "Asia", "SIDS", "LDC", "Kiribati",
"Gross domestic savings", 7.9`}, {2001.`, "Asia", "SIDS", "LDC",
"Kiribati", "Internet users", 8.6`}};
and
jdata = Join @@
Map[a \[Function]
Dataset[AssociationThread[First@a, #] & /@ Rest[a]]][{rawdata}];
generates:
I want to calculate "percentage change" for a given country and a given indicator over the beginning and end years available. For example, for Bhutan percentage change in Tax revenues
over period 2000-2001.
I tried other operations such as below:
jdata[All, {"time", "country", "data"}][All, "data"] // Mean
which is the mean value of all the data regardless of country and indicator.
This also gives me a result:
jdata[GroupBy["country"], Total[#] &, "data"]
which is the total of data (regardless of indicator) over the period 2000-2001. The percentage change calculation for individual countries should have the form:
jdata[GroupBy["country"], PercentageChange[Log[#2]-Log[#1]] &, "data"]
I cannot figure out how to do the percentage change in an indicator of a given country during a specific period of time (in my original data set, the time goes from 2000 to 2030), and in fact, I want to be able to select a subset within the entire time period.
EDIT