Skip to content
Prev 386792 / 398502 Next

replace zero in a matrix using random numbers

Hello,

Try to get the number of zero values before:

i <- er.miRCounts == 0
n <- sum(i)
er.miRCounts[i] <- rnorm(n,mean=1, sd=0.1)


Also, there is no need for a end-of-instruction ';'.
The semi-colon is the instruction separator, so if you put it at the end 
you will be separating the instruction you wrote from the NULL 
instruction. A simpler example could be

mean(1:5);

This is *two* instructions:

mean(1:5); NULL


Hope this helps,

Rui Barradas

?s 22:33 de 08/01/21, Yuan Chun Ding escreveu: