Here's a small dataset
RWC<-as.data.frame(matrix(1:9,ncol=3))
RWC
V1 V2 V3
1 4 7
2 5 8
3 6 9
I'm trying to normalise by suming the rows separately and have the original number divide by the sum. This should lead to this (I do not need the rounding, this is just for convenience).
V1 V2 V3
0.08 0.33 0.58
0.13 0.33 0.53
0.16 0.33 0.50
I've so far written
for(i in 3:nrow(RWC)){
normalise <- sum(row[3:ncol])
RWC <- ()
}
I'm stuck on trying to divide and give the value to the specific row and column, how would I do this?