Question: Using R, I am trying to populate an empty data frame with calculation results based on data from another dataset. However, due to the large

Using R, I am trying to populate an empty data frame with calculation results based on data from another dataset. However, due to the large amount of data, I want to have a loop that can loop through the years and countries. For example:

EU[which(EU$Country=="Austria"),which(colnames(EU)=="eu_enei_13")] = filter(eurostat, TIME==2013 & GEO=="Austria" & NACE_R2=="Total - all NACE activities" & INDIC_PEFA=="Extraction of natural energy inputs")[,which(colnames(eurostat)=="Value")]

where eu_enei_13 is a calculation result, EU is the empty data frame and eurostat is the source dataset.

Please give me some advice.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!