Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step_lag() add a datetime index parameter so that lag is not carried over gaps in non continuous time series. #860

Closed
jacekkotowski opened this issue Nov 26, 2021 · 3 comments
Labels
reprex needs a minimal reproducible example

Comments

@jacekkotowski
Copy link

Feature

In situations when time series data is not continuous, e.g. in bicycle bike sharing competition by Kaggle https://www.kaggle.com/c/bike-sharing-demand/ it would be useful to have the possibility to prevent step_lag() for jumping over gaps in time series. In the case of the competition, data is missing each month after the 20th day.

e.g.
step_lag(atemp, lag = 2 index_col = datetime)

There is a gap in time series (after 20th day of January, NA is returned

datetime, temp, lag_temp
2019-01-17,12, NA
2019-01-18,12, 12
2019-01-19,11, 12
2019-01-20,10, 11
2019-02-01,11, NA
2019-02-02,12, 11
2019-02-03,13, 12

@jacekkotowski jacekkotowski changed the title step_lag() add a datetime index parameter so that lag is not carried out over gaps in non continuous time series. step_lag() add a datetime index parameter so that lag is not carried over gaps in non continuous time series. Nov 26, 2021
@juliasilge
Copy link
Member

Can you create a reprex (a minimal reproducible example) for this feature request? The goal of a reprex is to make it easier for us to recreate your situation so that we can understand and evaluate it. Rather than downloading a large dataset from Kaggle, use some built-in or in-lined data and try to clearly outline what behavior you are seeing now vs. what you need for your use case.

If you've never heard of a reprex before, you may want to start with the tidyverse.org help page. You may already have reprex installed (it comes with the tidyverse package), but if not you can install it with:

install.packages("reprex")

Thanks! 🙌

@EmilHvitfeldt EmilHvitfeldt added the reprex needs a minimal reproducible example label Apr 14, 2022
@EmilHvitfeldt
Copy link
Member

I'm closing this for inactivity. If this functionality is still requested, please file another issue!

Copy link

github-actions bot commented Jun 7, 2024

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

3 participants