[Rd] Potential Bug in convolve {stats}

George Anastasiou georges.anastasiou at gmail.com
Tue May 9 12:19:35 CEST 2017


Dear All,

I think there is a bug in the convolve function of stats package. Running
the following:

a <- convolve(c(1,1,1,1), 1, type="filter")
a

the answer is:

[1] 1 1

whereas it should be:

[1] 1 1 1 1

Looking at the code of convolve, the bug is on line 22 at:

[-c(1L:n1, (n - n1 + 1L):n)]/n


which is not correct when the second input argument has only one element
(n1=0).

When I run R.version I get the following output:

platform       i686-pc-linux-gnu
arch           i686
os             linux-gnu
system         i686, linux-gnu
status
major          3
minor          4.0
year           2017
month          04
day            21
svn rev        72570
language       R
version.string R version 3.4.0 (2017-04-21)
nickname       You Stupid Darkness


Best,

George Anastasiou

	[[alternative HTML version deleted]]



More information about the R-devel mailing list