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

Excel time to numeric #479

Merged
merged 27 commits into from
Dec 7, 2023
Merged

Conversation

billdenney
Copy link
Collaborator

Replaces #246 (by switching to the main branch) and fixes #245

@billdenney
Copy link
Collaborator Author

@sfirke , Hopefully this can make the next CRAN release.

@codecov
Copy link

codecov bot commented Apr 15, 2022

Codecov Report

Merging #479 (7799926) into main (bb23615) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 7799926 differs from pull request most recent head 25ee9c2. Consider uploading reports for the commit 25ee9c2 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #479   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        27    +1     
  Lines         1184      1273   +89     
=========================================
+ Hits          1184      1273   +89     
Files Coverage Δ
R/excel_dates.R 100.00% <ø> (ø)
R/excel_time_to_numeric.R 100.00% <100.00%> (ø)

@sfirke
Copy link
Owner

sfirke commented Jan 4, 2023

I can review this this week.

@sfirke sfirke self-requested a review January 4, 2023 16:20
@billdenney
Copy link
Collaborator Author

@sfirke, I found myself needing this function today. So: ping! 😄

@sfirke
Copy link
Owner

sfirke commented Nov 7, 2023

Ack sorry I have been so slow! Thanks for the ping, I will try to review soon.

Copy link
Owner

@sfirke sfirke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the actual code, not the tests yet. Code looks great, all that thinking about time format regex has me 😵‍💫

R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Show resolved Hide resolved
R/excel_time_to_numeric.R Outdated Show resolved Hide resolved
R/excel_time_to_numeric.R Show resolved Hide resolved
tests/testthat/test-excel_time_to_numeric.R Outdated Show resolved Hide resolved
@billdenney
Copy link
Collaborator Author

I think that I've addressed all the comments. Can you please take one more look and merge if it looks good to you?

expect_equal(excel_time_to_numeric("1899-12-31 21:05:20 foo"), 21 * 3600 + 5 * 60 + 20)
})

test_that("excel_time_to_numeric, POSIX times treat no time as midnight but only if there is a space indicating a mostly-well-formed date-time object.", {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like there must be some story behind this use case 😆

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd be amazed at the trash that I have to sort through in some of my source data. (Or maybe as the originator of janitor, you wouldn't 😄 .) I sometimes get fields that have multiple data points concatenated together. Dates and times are especially bad. As long as it fully matches an expected format (maybe with extra bits at the end), I wanted to let it in.

@sfirke
Copy link
Owner

sfirke commented Dec 7, 2023

@billdenney this looks great! Thank you very much, both for the great code and the patience as I was slow to review.

Feel free to squash and merge. I thought one block of tests was redundant and wanted to leave the chance for you to remove it (if I'm not missing something) before merging, but this is ready to go.

I wonder if it's a good impetus to start the next CRAN submission, to make this available to a broader user base.

@billdenney billdenney merged commit f16cf42 into sfirke:main Dec 7, 2023
7 checks passed
@billdenney billdenney deleted the excel_time_to_numeric branch December 7, 2023 13:42
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

Successfully merging this pull request may close these issues.

Feature Request: excel_numeric_to_time
3 participants