Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upshift should accept negative n #1708
Comments
|
Could make moving-average windowing very simple |
|
Agreed that this looks much better. At the time, I added |
|
Having a cyclic shift would be interesting, and that would also benefit from having negative |
|
could you elaborate what you guys have in mind with |
|
@MichaelChirico I think they just mean that the unused values are shifted around to "fill", like
|
|
Michael, google for |
|
Would still love to have this -- so many times I want to facilitate moving averages like |
|
Is there agreement on negative |
|
I think that having negative |
|
It will be more consistent to current code, as described above. |
|
Yeah, I guess you are right if we want to keep this backward compatible. I was thinking it could be a good thing to deprecate |
|
We can just map it change |
|
@jangorecki |
|
i think because it's ambiguous it makes sense to keep so that code can be more readable. Unless we want to go the That said, I think most of the use cases involving mixed indices are of the form If we're going to deprecate anything, maybe the name |
|
I don't see anything wrong about name |
That looks like a typo on my part; sorry for the confusion. |
|
SO post to update, https://stackoverflow.com/a/52432516
Tangent: This "shift a single logical vector and then collapse by OR or AND" use case is pretty common for me at least. It is essentially a rolling |
I think using "type = lag/lead" is a lot of unnecessary typing, and using a negative shift would be much simpler and more intuitive. It would also allow for more nifty multiple shifts going from lead to lag by typing e.g.
shift(vec, -5:5).The "type" argument can still stay and negative shift would simply reverse the meaning of "type".
n = 0should also be accepted and simply return the original vector.