Skip to content
Back to formatted view

Raw Message

Message-ID: <20120221203811.GA12461@cs.cas.cz>
Date: 2012-02-21T20:38:11Z
From: Petr Savicky
Subject: In R 2.14.1, what does wrong sign in 'by' argument mean?
In-Reply-To: <1329850424198-4407926.post@n4.nabble.com>

On Tue, Feb 21, 2012 at 10:53:44AM -0800, bioinformatics wrote:
> Here is my code
> 
> 
>     slidingwindowplotATGC = function(windowsize, inputseq) 
>     {
> 
>     starts = seq(1, length(inputseq)-windowsize, by = windowsize)
>     n = length(starts)
>     chunkGs = numeric(n)
>     chunkAs = numeric(n)
>     chunkTs = numeric(n)
>     chunkCs = numeric(n)
>     for (i in 1:n) { 
>         chunk = windowsize[starts[i]:(starts[i]+9999)]
>         chunkG = sum("g" == chunk)/length(chunk)
>         chunkA = sum("a" == chunk)/length(chunk)
>         chunkT = sum("t" == chunk)/length(chunk)
>         chunkC = sum("c" == chunk)/length(chunk)
> 	  chunkGs[i] = chunkG
>         chunkAs[i] = chunkA
> 	  chunkTs[i] = chunkT
> 	  chunkCs[i] = chunkC
> 	}   
>    
> plot(starts,chunkGs,type="b",ylim=c(min(min(chunkAs),min(chunkTs),min(chunkCs),min(chunkGs)),max(max(chunkAs),max(chunkTs),max(chunkCs),max(chunkGs))),col
> = "red")
>     points(starts,chunkTs,col = "blue")
>     points(starts,chunkAs,col = "green")
>     points(starts,chunkCs)
> }
> 
> 
> Im getting the following error message,
> 
>     Error in seq.default(1, length(inputseq) - windowsize, by = windowsize)
> : 
>       wrong sign in 'by' argument
> 

Hi.

Try to set options(error=utils::recover) before the run. When
the error occurs, you can see the values of the variables
inside the function, where the error occured.

Hope this helps.

Petr Savicky.