_
> > From: ruipbarra...@sapo.pt
> > Sent: Monday, March 21, 2016 11:50 AM
> > To: Stephen HK WONG
> > Cc: r-help@r-project.org
> > Subject: Re: [R] how to use vectorization instead of for loop
> >
> > Hello,
> >
> > I've renamed your datafra
> Sent: Monday, March 21, 2016 11:50 AM
> To: Stephen HK WONG
> Cc: r-help@r-project.org
> Subject: Re: [R] how to use vectorization instead of for loop
>
> Hello,
>
> I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
>
> dat[, 4] &l
sing ifelse ?
Thanks.
From: ruipbarra...@sapo.pt
Sent: Monday, March 21, 2016 11:50 AM
To: Stephen HK WONG
Cc: r-help@r-project.org
Subject: Re: [R] how to use vectorization instead of for loop
Hello,
I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
dat[, 4
Dear All,
I have a dataframe like below but with many thousands rows,
structure(list(gene_id = structure(1:6, .Label = c("0610005C13Rik",
"0610007P14Rik", "0610009B22Rik", "0610009L18Rik", "0610009O20Rik",
"0610010B08Rik,OTTMUSG0016609"), class = "factor"), log2.fold_change. =
c(0.0114463,
Hello,
I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
dat[, 4] <- ifelse(dat[, 2] > 0, 1 * (1/dat[,3]), -1* (1/dat[,3]))
Oh, and why do you multiply by 1 and by -1?
It would simply be 1/dat[,3] and -1/dat[,3].
Hope this helps,
Rui Barradas
Quoting Stephen HK WONG :
5 matches
Mail list logo