There is a couple of similar questions here but I failed to apply them to my case. I have many tables like this:
GDP:
time   |    AT    |    BE   |     BG    |     CF    | : United kingdom
2014Q4 |   4564   |  4646   |    6541   |     122   | :
2014Q3 |   1234   |  5789   |    3545   |     3546  | :
2014Q2 |   1456   |   354   |    3541   |     3543  | :
:      |    :     |    :    |     :     |      :    | :
1990Q1 |   1234   |  3546   |    6546   |     5466  |
REER: the similar table etc.
how can I reshape them to the following style:
       Country | time   |    GDP |  REER  |   :..
            AT | 1990Q1 |   4564 |  4646  |   6541  |    122  | :
            AT | 1990Q2 |   1234 |  5789  |   3545  |   3546  | :
            AT | 1990Q3 |   1456 |   354  |   3541  |   3543  | 
             : |  :     |   :    |   :    |     :   |      :  | :
United Kingdom | 2014Q4 |   1234 |  3546  |   6546  |   5466  |
the code
setwd ("D:/Documents/R/eurostatData")
library (SmarterPoland)
library(reshape)
library (xlsx)
# Write to xls file --------------------------------------------------------
save.xlsx <- function (file, ...)
{
  require(xlsx, quietly = TRUE)
  objects <- list(...)
  fargs <- as.list(match.call(expand.dots = TRUE))
  objnames <- as.character(fargs)[-c(1, 2)]
  nobjects <- length(objects)
  for (i in 1:nobjects) {
    if (i == 1)
      write.xlsx(objects[[i]], file, sheetName = objnames[i])
    else write.xlsx(objects[[i]], file, sheetName = objnames[i],
                append = TRUE)
  }
  print(paste("Workbook", file, "has", nobjects, "worksheets."))
}
# load TOC
TOC <- grepEurostatTOC("Production") # get everything about Production
TOC2 <- getEurostatTOC()
View(TOC)
# END TOC
dat_raw <- getEurostatRCV("sts_inpr_q") # quaterly
# how many unique values are?
unique(dat_raw$indic_bt)
unique(dat_raw$nace_r2) # initialy I need C - manufacturing
unique(dat_raw$time) # 1980-20104
production <- cast(dat_raw,  time ~ geo, subset= nace_r2=="C" & s_adj=="GROSS" )
# RESHAPING
# !!!!nothing to write, since the steps I did were not successful.!!!!
save.xlsx("data.xlsx", production, turnover_dom, turnover_ndom, import_price,  producer_prices, labour, GCF, gdp, inflation)
 
    