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

Show last X weeks in the shiny app #1

Open
mhoehle opened this issue Dec 11, 2016 · 4 comments
Open

Show last X weeks in the shiny app #1

mhoehle opened this issue Dec 11, 2016 · 4 comments

Comments

@mhoehle
Copy link

mhoehle commented Dec 11, 2016

@dirkschumacher The number put here doesn't appear to be interpreted as weeks. For example "6" only gives 1/2 weeks. Could it be that it's interpreted as days if the time series has epochAsDate=TRUE and correctly as time clicks otherwise?

screen shot 2016-12-11 at 10 55 45

@dirkschumacher
Copy link
Member

Probably, yes. So either changing it to "show last X days" or multiply by 7.

@mhoehle
Copy link
Author

mhoehle commented Dec 11, 2016

It's a little more complicated, because it depends on whether the sts class uses epochAsDate is true. Something like:

if (x@epochAsDate) {
firstDayToShow <- tail(epoch(x),n=1) - 7 * nWeeksBack
} else {
oneWeekInFreqUnits <- switch( as.character(object@freq), "12" = 1/4,"52" = 1,"365" = 7)
firstDayToShow <- nrow(x) - round(oneWeekInFreqUnits * nWeeksBack)
}

@dirkschumacher
Copy link
Member

Cool. Ok, I will add it either tomorrow or the day after

@mhoehle
Copy link
Author

mhoehle commented Dec 11, 2016

Cool, let me know and I'll be happy to test it. Note that the above is pseudo code, could be that the variable names are slighly different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants