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

Documentation #52

Closed
kinto-b opened this issue Oct 19, 2021 · 13 comments · Fixed by #55
Closed

Documentation #52

kinto-b opened this issue Oct 19, 2021 · 13 comments · Fixed by #55

Comments

@kinto-b
Copy link
Contributor

kinto-b commented Oct 19, 2021

Looks good to me. Only thing that should be fixed before this is merged are the links in the vignette.

Actually the whole "Categories" section probably needs a revamp given that it doesn't really align with the "Expectations" section of the "Reference" page.

But looking at the "Reference" page now, it's still not organized in the best possible way.

For instance, do the "Expectations - auto-generated" really constitute a reasonable category? I now realise it made more sense before as "value expectations", but that's still not perfect. Perhaps "Expectations - format" for pattern, length, date, and so on, "Expectations - values" for value and range, and something else for text missingness (which are potentially questionable given the existence of expect_base).

Additionally, the descriptions are inconsistent. Some have "checks" in the description, others don't, etc.

Originally posted by @kinto-b in #45 (review)

@gorcha
Copy link
Collaborator

gorcha commented Oct 19, 2021

Ta! Also see #34

@gorcha gorcha added this to the CRAN / testdat 0.3.0 milestone Oct 19, 2021
@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 19, 2021

Oh missed that, probably could've just piggy backed. I was thinking about looking at this today and doing a PR. I reckon it's a good idea to split up the functions across more man pages. More user friendly that way, and be able to write up more pointed documentation.

I'm thinking relabeling for consistency:

  • Expectations: consistency
  • Expectations: comparisons
  • Expectations: generic helpers
  • Expectations: exclusivity
  • Expectations: labels
  • Expectations: proportions
  • Expectations: uniqueness

And breaking up the auto-generated ones

  • Expectations: values -- expect_values(), expect_range()
  • Expectations: patterns -- expect_regex(), expect_max_length()
  • Expectations: dates -- expect_date_yyyy(), expect_date_yyyymm(), expect_date_yyyymmdd()
  • Expectations: text -- expect_text_miss(), expect_text_nmiss()

The chk_*() family will be broken up to match:

  • Checks: values
  • Checks: patterns
  • etc.

And I'll make sure there's at least one example for each exported function.

Thoughts?

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

Also, perhaps it's best to use @describeIn for man pages that document functions which require separate description, like the conditional expectations

We end up with a cordoned off Functions section:

image

@gorcha
Copy link
Collaborator

gorcha commented Oct 20, 2021

Awesome, that documentation structure looks great!

The only other thought I had is combining the corresponding expect and chk functions into the one man page, but that might be a bit weird because the function signature and use case are quite different, what do you think?

Personally I prefer @rdname to @describeIn but I can't actually remember why so not super fussed. Does @describeIn still include separate usage entries?

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

@gorcha Sweet :)

Yeah, it seems to do exactly rdname does only with the addition of that Functions section:

image

I think it's better to keep them separate and link them using @seealso and/or by mentioning the chk_*() function in the corresponding expect_*() man page.

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

@gorcha slightly off topic, but I'm just documenting the chk_text_miss functions --- what exactly is the envisioned use-case for these?

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

@gorcha Do you think it's worth addressing the inconsistency between expect_regex and chk_pattern ?

@gorcha
Copy link
Collaborator

gorcha commented Oct 20, 2021

Good question! They're related to some of the text cleaning in the sample cleaning functions, essentially for making sure that any missing placeholders that might have crept in from other systems are removed.

Not 100% sure of their usefulness, it's almost a special case of chk_values() or !chk_values().

@gorcha
Copy link
Collaborator

gorcha commented Oct 20, 2021

Also yes definitely re: chk_pattern() - I think it should be renamed to chk_regex() since that seems clearer and more direct to me.

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

Cool, have opened a new issue for chk_pattern().

Hm, I can't really come up with a good example to demonstrate their usefulness. The only thing I can think of is:

clean <- ifelse(chk_text_miss(dirty), "", dirty)

But that doesn't really seem like a job for testdat. And it's debatable whether that's better than the user defining their own missing text based on the systems their interfacing with (e.g. it's risky to remove "0" in a less than explicit way).

I can't really think of anything for chk_text_nmiss().

@gorcha
Copy link
Collaborator

gorcha commented Oct 20, 2021

Yeah agreed. I think chk_text_nmiss() (or expect_text_nmiss()) is potentially useful for expecting that these kinds of values don't exist, but a complement for (chk|expect)_values() is probably a better way to do this.

@gorcha
Copy link
Collaborator

gorcha commented Oct 20, 2021

It might be good to have a more direct expect_not_missing() function as well (basically expect_base(var, TRUE))

@kinto-b
Copy link
Contributor Author

kinto-b commented Oct 20, 2021

I'm gonna open up an issue for it specifically

kinto-b added a commit that referenced this issue Oct 20, 2021
@kinto-b kinto-b linked a pull request Oct 20, 2021 that will close this issue
kinto-b added a commit that referenced this issue Oct 21, 2021
gorcha added a commit that referenced this issue Oct 31, 2021
Clean up documentation and intro vignette and add missing examples. Close #52, close #34.

* Reorganise man pages (#52)
* Fix links in vignette (#34)
* Add examples (#52)
* Minor documentation updates and code formatting
* Vignette updates and associated changes (#34)

Co-authored-by: Kinto <kinto.behr@gmail.com>
Co-authored-by: Danny Smith <danny@gorcha.org>
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 a pull request may close this issue.

2 participants