Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 13 forks source link

Add function for checking date types #48

Closed Moohan closed 3 years ago

Moohan commented 3 years ago

Resolves #47

Moohan commented 3 years ago

Hi James, before I review this can you please fix the problem that's causing the build to fail with Travis?

That should be it, it just wanted a bit of extra documentation. Sorry, thought I had run a full check before submitting! The checks definitely pass on the server now, so hopefully Travis will report the same shortly!

Moohan commented 3 years ago

I've just had a thought that it would probably make more sense to move the whole if (!is_date(date)) stop("The input must have Date or POSIXct class") bit into the function so that it could just be used as is_date(date).

Let me know if you want me to refactor like that?

davidc92 commented 3 years ago

Actually, I've taken a look at what this PR is doing and I don't like creating a new function which is just another function with a different name. If the problem is the error handling in qtr is too strict, then can you just add the extra arguments to the inherits function rather than wrapping an extra layer of functions around it?

Moohan commented 3 years ago

Closing this as there is a simpler fix in #50 as suggested by @davidc92