Bug 16135 - error in: convolve( 1:5, 1, type='filter')
Summary: error in: convolve( 1:5, 1, type='filter')
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Analyses (show other bugs)
Version: R 3.0.2
Hardware: All All
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-01-06 14:07 UTC by Frank Schwidom
Modified: 2015-01-06 14:07 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Schwidom 2015-01-06 14:07:23 UTC
> convolve( 1:5, c( 1), type='filter')

# leads to:

[1] 2 3 4

# but should output:

[1] 1 2 3 4 5

-----------------------------------------------

by setting the second parameter to 1 there happens inside
of convolve an list-reversion in the codepiece:

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

n1 was first defined by length( y) - 1 and is currently 0,
so that 1L:n1 leads to c( 1, 0)

it would function, if the : operator would return
c(), when 1:0 is given.

a solution could be the introduction of an trueRange-function
which behaves like the range-function in the language python