-project.org
Subject: Re: [R] replace zero in a matrix using random numbers
?rnorm tells you that n, the first argument, is the number of
observations/random numbers you wish to generate. You asked for 1.
So you need to ask for the number of 0's, something like:
> a <- matrix(rep(0:1,
?rnorm tells you that n, the first argument, is the number of
observations/random numbers you wish to generate. You asked for 1.
So you need to ask for the number of 0's, something like:
> a <- matrix(rep(0:1, 3), nrow =3)
> a
[,1] [,2]
[1,]01
[2,]10
[3,]01
> a[!a] <-
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 instructio
3 matches
Mail list logo