Operation for each row of data frame in R
Post date: Aug 7, 2014 9:40:41 PM
Here we show how to do normalize/cumulative sum for each row:
## normalize each row t(apply(mydata,
1,
function(x)(x-min(x))/(max(x)-min(x)))) ## cumulative sum mySum = t(apply(df, 1, cumsum))
For more info:
http://stackoverflow.com/questions/20046257/normalize-rows-of-a-matrix-within-range-0-and-1 http://stackoverflow.com/questions/7550383/calculating-cumulative-sum-for-each-row-in-r