Normalize rows of a matrix within range 0 and 1

后端 未结 3 2027
孤城傲影
孤城傲影 2020-12-30 02:28

I am trying to normalize all rows of my matrix data at once within range 0 and 1. But I don\'t know how to do it.. For example, I want to normalize each \"obs1\", \"obs2\",

3条回答
  •  别那么骄傲
    2020-12-30 03:05

    for(i in 2:length(mydata[1,])){
    
        mydata[,i] <- prop.table(mydata[,i])
    
    }
    

    Normalized matrix will be updated in mydata

提交回复
热议问题