Hi Bert and Rui,
Thank you very much! I had thought for every condition of matrix ==0 ,
rnrom(n=1, 1, 0.1) will randomly generate a number with mean 1 and sd 0.1.
Yuan
From: Bert Gunter [mailto:bgunter.4...@gmail.com]
Sent: Friday, January 8, 2021 2:49 PM
To: Yuan Chun Ding
Cc: r-help@r-pro
?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
Hi R users,
I am analyzing miRNA sequence data for a special network analysis, I need to
replace zero values in a matrix as random numbers with mean of 1 and standard
deviation of 0.1.
er.miRCounts[er.miRCounts==0] <- rnorm(1,mean=1, sd=0.1);
this code made all zero values as 1.13, not random
This list has a no-homework policy.
---JRG
On 2021-01-08 09:43, zyra e madhe wrote:
> Hello,
>
> I'm having difficulty doing the following exercise.
> Can you please provide the code and some written explanation?
>
> Thank you in advance,
>
> Zyra
>
>
> ___
Hello,
I'm having difficulty doing the following exercise.
Can you please provide the code and some written explanation?
Thank you in advance,
Zyra
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listin
Thank you Rui and Thierry for the suggestion, it helped me.
thanks
On Fri, Jan 8, 2021 at 6:58 AM Rui Barradas wrote:
> Hello,
>
> What about the following?
> First get the min and max of value by variable == "y1".
> Then use that range to scale up "y2".
>
> rng <- tapply(daT1$value, daT1$varia
Hello,
What about the following?
First get the min and max of value by variable == "y1".
Then use that range to scale up "y2".
rng <- tapply(daT1$value, daT1$variable, range)$y1
ggplot(data = daT1, aes(x = x, group = variable, color = variable)) +
geom_line(data = subset(daT1, variable == "y1
Hi
dcast from reshape is close, however column order is different
mydf <- dcast(df.long, sample~marker)
(!is.na(mydf[,-1]))*1
g j k u x y
[1,] 1 0 1 0 1 0
[2,] 0 1 0 1 1 1
[3,] 0 0 0 0 1 1
You just need to change 0 to NA and add rownames from mydf.
Cheers
Petr
> -Original Message-
9 matches
Mail list logo