Mark Cowley | 26 Feb 13:27 2013
Picon

Re: Simple question about Vector

Hi Thiago,
have a look at ?ifelse or ?abs
cheers, 
Mark

On 26/02/2013, at 10:46 PM, "Thiago [guest]" <guest@...> wrote:

> 
> Hello
> 
>   I'm new at bioconductor and I have a very simple and stupid question, but I couldn undertand how to do that.
> 
> I have a vector with a column with negative numbers(double). I want to change all negative to positive.
> I then made a function:
> -----------------------------
> function(number){
>    if(number < 0){
>        number <- number * -1
>    }
>    return(number)
> }
> -----------------------------
> then I run
>> bed[12] <- arruma(bed[,11])
> 
> I got this error
> 
> Warning message:
> In if (number < 0) { :
>  the condition has length > 1 and only the first element will be used
> 
> What happen is that all negative became positive and all positive became negative.
> 
> Does enybody know what I'm doing wrong?
> 
> thanks and best regards
> 
> -- output of sessionInfo(): 
> 
>> sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> 
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
> [5] LC_TIME=English_United States.1252    
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base     
> 
> loaded via a namespace (and not attached):
> [1] tools_2.15.2
> 
> --
> Sent via the guest posting facility at bioconductor.org.
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@...
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

_______________________________________________
Bioconductor mailing list
Bioconductor@...
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor


Gmane