If I have a dataframe (df1) and I wanted to multiply each cell of the dataframe by the cells of a second dataframe (df2) based on matching column and row ID, how would I do that?
df1:
df1<-data.frame(id=rep(1:100),
Room1=rnorm(100,0.4,0.5),
Room2=rnorm(100,0.3,0.5),
Room3=rnorm(100,0.7,0.5))
df2:
df2<-data.frame(id=rep(1:100),
Room1=rnorm(100,1,7),
Room2=rnorm(100,12,13),
Room3=rnorm(100,4,20))
So the output is a dataframe (df3) where the value in row 1 column 2 of df1 (e.g. df1[1,2]) has been multiplied by the equivalent value in df2 (e.g. df2[1,2]) and df1[2,2]*df2[2,2], etc....