[BioC] Simple question about Vector
    Thiago [guest] 
    guest at bioconductor.org
       
    Tue Feb 26 12:46:11 CET 2013
    
    
  
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.
    
    
More information about the Bioconductor
mailing list