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

merge() creates NA values if date is POSIXct formatted #4

Open
mhasanbulli opened this issue Jan 19, 2018 · 2 comments
Open

merge() creates NA values if date is POSIXct formatted #4

mhasanbulli opened this issue Jan 19, 2018 · 2 comments

Comments

@mhasanbulli
Copy link

If date column is formatted as POSIXct, seq() function produces dates with daylight saving applied. This results in a sequence of days with hour components 23:00:00. When merge happens here

  dtDateValue = merge(dtDateValue, setnames(dtDateValue[ ,list(DateCol = seq(min(get(cDateColumnName)), max(get(cDateColumnName)),"days")), vcGroupingColumnNames], "DateCol", cDateColumnName),  c(vcGroupingColumnNames, cDateColumnName),  all = T)

dtDateValue is updated with NA values for days that have the daylight savings are applied.
2018-01-19 15_38_19- _gitlab_bike auckland - master - rstudio
Adding na.value = "white" to scale_fill_continuous() reveals those NA values like below.
rplot04
One solutions is that user formats the dates with as.Date() before plotting. Or, you might consider using as.POSIXct() with tz set to UTC in seq() and then merge.

@dasather
Copy link
Collaborator

Sorry for not getting back on this until now.

I've never worked with DST and I'm afraid I don't know how to recreate this. I tried this https://stackoverflow.com/questions/23611556/missing-hour-in-seq-function-generating-time-in-r but I didn't have the missing hour. Can you please help?

@mhasanbulli
Copy link
Author

That is all good. I will get latest and see what I can do. Then, send a pull request.

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