I have the following input frame:
df1 <- data.frame(row.names=c("AA","BB","CC","DD","EE"), A=c(0.90,0.75,0.65,0.55,0.45), B=c(0.80,0.75,0.60,0.60,0.45))
Row A B
AA 0.90 0.80
BB 0.75 0.75
CC 0.65 0.60
DD 0.55 0.60
EE 0.45 0.45
Is there a way to divide the values ββin row AA by the value in row BB (0.90 / 0.75 = 1.200). Then I want to split this new value in line BB by the value in line CC (1.2 / 0.65 = 1.846), etc. To create the following output frame:
Row A B
A 0.900 1.067
B 1.200 1.067
C 1.846 1.778
D 3.357 2.963
E 7.459 6.584
I really scratch my head with this, so any help is greatly appreciated.
Thanks guys!
source
share