Re: [R] replacing then summing by values from another dataframe

2015-08-11 Thread Gerrit Eichner
Hello, Xianming, I have changed your (particular) data structure: use matrices because you have only numeric scores and effects, use NA instead of -1 as missing value (as usual), don't use columns for ids or row/column names (except for the easy of reading the data structures), increase your s

Re: [R] replacing then summing by values from another dataframe

2015-08-10 Thread PIKAL Petr
Hi Not sure about elegancy/efficiency. library(reshape2) dat3 <- melt(dat2) dat3 mid variablevalue 1 m10 -19.5482 2 m20 -0.5120 3 m30 -0.4920 4 m11 0.0070 5 m21 3.2410 6 m31 -2.2560 7 m12 1.2230 8 m22 -4.490