I have been having a problem with two data frames that I want to merge. One is larger than the other but they share common column names and rownames.
What I would like to do is merge both of them by their specific elements in each row and column.
For example I have 1 data frame:
row.names-US Bond,US Stock,EU Bond,EU Stock,Asia Bond,Asia Stock,col.names-Price Risk,Credit Risk,Market Risk;
The other data frame:
row.names-US Bond,US Stock;col.names-Price Risk;
Ideally, I would like to merge both data sets by their unique row name and column name.
Sample:
dat1<-matrix(' ',nrow=4,ncol=6)
colnames(dat1)<-c("Value","Percentage","Credit.Risk","Interest.Risk","Interest.Credit.Risk","Total")
rownames(dat1)<-c("Low.Gov.Debt","Low.Corp.Debt","High.Gov.Debt","High.Corp.Debt")
new<-portfolio
rownames(new)<-c("High.Gov.Debt","Low.Gov.Debt")
colnames(new)<-c("Value")