How to calculate real data set from Deflator and nominal data set by using matrix?

I have a 6 countries Deflator & Nominal data set from 1996-2015. I want to try to get those 6 countries' real data set by using the matrix in Rstudio. as an example, in Deflator data 6 countries different benchmark year( Brazil (benchmark yr 2000), Canada benchmark yr 2007), Japan (benchmark yr 2011, Korea(benchmark yr 2010), USA (benchmark yr 2012), South Africa (benchmark yr 2010). So, at first, I would like to change all countries benchmark year into 2012 as USA benchmark year. And all countries have 6 variables like consumption, government expenditure, Investment, export, Import and Gdp. At first, I am trying to filter Brazil & convert into the matrix & took diag & took only Brazil 2012 Year's data & transpose and after that multiply three matrix, as the command bellow

Brazil<-Deflator %>% filter(Country=="Brazil")  
Brazilov<-Brazil[3:8] Brazilmat<-as.matrix(Brazilov) 
BrazilDebenmat<-matrix(BrazilDebenov) t(as.matrix(BrazilDebenov)) as.matrix(Brazilov)%*%diag(6)%*%t(as.matrix(BrazilDebenov)) 

but I get only one column result. I want to need to change all Brazil variable's benchmark year 2012 instead of 2000.

Would you please give me some instruction regarding this issue. Thank you in advance.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.