Skip to content

datefixR: Fix Really Messy Dates #533

Closed

Description

@nathansam

Date accepted: 2022-07-16
Submitting Author Name: Nathan Constantine-Cooke
Submitting Author Github Handle: @nathansam
Other Package Authors Github handles: (comma separated, delete if none)
Repository: https://github.com/nathansam/datefixR
Version submitted: 0.1.4.9000
Submission type: Standard
Editor: @adamhsparks
Reviewers: @AlvesKS, @alstat

Due date for @AlvesKS: 2022-05-30

Due date for @alstat: 2022-07-15
Archive: TBD
Version accepted: TBD
Language: en

  • Paste the full DESCRIPTION file inside a code block below:
Package: datefixR
Title: Fix Really Messy Dates
Version: 0.1.4.9000
Authors@R: person("Nathan",
                  "Constantine-Cooke",
                  email = "nathan.constantine-cooke@ed.ac.uk",
                  role = c("aut", "cre"),
                  comment = c(ORCID = "0000-0002-4437-8713"))
Description: Fixes messy dates in data frames such as those entered via text
  boxes. Standardizes / - and whitespace separation, month abbreviations, and
  year first or day first by converting to R's built-in Date class. Imputes
  missing date or month using user-provided values.  
License: GPL (>= 3)
Depends: R (>= 4.0.0)
Imports: 
    lifecycle,
    stringr
Language: en-US
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
URL: https://www.constantine-cooke.com/datefixR/ https://github.com/nathansam/datefixR
BugReports: https://github.com/nathansam/datefixR/issues
Suggests: 
    rmarkdown,
    knitr,
    testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr

Scope

  • Please indicate which category or categories from our package fit policies this package falls under: (Please check an appropriate box below. If you are unsure, we suggest you make a pre-submission inquiry.):

    • data retrieval
    • data extraction
    • data munging
    • data deposition
    • data validation and testing
    • workflow automation
    • version control
    • citation management and bibliometrics
    • scientific software wrappers
    • field and lab reproducibility tools
    • database software bindings
    • geospatial data
    • text analysis
  • Explain how and why the package falls under these categories (briefly, 1-2 sentences):

datefixR takes date data in which has been stored in many different formats (01/01/2001, 5 April 2020, Dec 2015 etc.) and converts them to R's Date type.

  • Who is the target audience and what are scientific applications of this package?

Any researchers using data entered via a questionnaire which (unfortunately) asked for a date as free-text. Given the nature of this data generation, this mainly affects those who work with human subjects.

lubridate::guess_formats() can be used to guess a date format and lubridate::parse_date_time() calls this function when it attempts to parse a vector into a POSIXct date-time object. However:

  1. When a date fails to parse in {lubridate} then the user is simply told how many dates failed to parse. In datefixR the user is told the ID (assumed to be the first column by default but can be user-specified) corresponding to the date which failed to parse and reports the considered date: making it much easier to figure out which dates supplied failed to parse and why.
  2. When imputing a missing day or month, there is no user-control over this behaviour. For example, when imputing a missing month, the user may wish to impute July, the middle of the year, instead of January. However, January will always be imputed in {lubridate}. In datefixR, this behaviour can be controlled by the month.impute argument.
  3. These functions require all possible date formats to be specified in the orders argument, which may result in a date format not being considered if the user forgets to list one of the possible formats. By contrast, datefixR only needs a format to be specified if month-first is to be preferred over day-first when guessing a date.

However, {lubridate} of course excels in general date manipulation and is an excellent tool to use alongside datefixR.

An alternative function is anytime::anydate() which also attempts to convert dates to a consistent format (POSIXct). However {anytime} assumes year, month, and day have all been provided and does not permit imputation. Moreover, if a date cannot be parsed, then the date is converted to an NA object and no warning is raised- which may lead to issues later in the analysis.

NA

  • If you made a pre-submission inquiry, please paste the link to the corresponding issue, forum post, or other discussion, or @tag the editor you contacted.

#529

  • Explain reasons for any pkgcheck items which your package is unable to pass.

pkgcheck claims: "Package has no continuous integration checks." however Github actions is already used so this is a false positive.

Technical checks

Confirm each of the following by checking the box.

This package:

Publication options

  • Do you intend for this package to go on CRAN?
  • Do you intend for this package to go on Bioconductor?

(Already available on CRAN)

NA

MEE Options
  • The package is novel and will be of interest to the broad readership of the journal.
  • The manuscript describing the package is no longer than 3000 words.
  • You intend to archive the code for the package in a long-term repository which meets the requirements of the journal (see MEE's Policy on Publishing Code)
  • (Scope: Do consider MEE's Aims and Scope for your manuscript. We make no guarantee that your manuscript will be within MEE scope.)
  • (Although not required, we strongly recommend having a full manuscript prepared when you submit here.)
  • (Please do not submit your package separately to Methods in Ecology and Evolution)

Code of conduct

Activity

  1. ropensci-review-bot commented on Apr 29, 2022

    @ropensci-review-bot
    Collaborator

    Thanks for submitting to rOpenSci, our editors and @ropensci-review-bot will reply soon. Type @ropensci-review-bot help for help.

  2. ropensci-review-bot commented on Apr 29, 2022

    @ropensci-review-bot
    Collaborator

    🚀

    Editor check started

    👋

  3. ropensci-review-bot commented on Apr 29, 2022

    @ropensci-review-bot
    Collaborator

    Checks for datefixR (v0.1.4.9000)

    git hash: 5513135a

    • ✔️ Package is already on CRAN.
    • ✔️ has a 'codemeta.json' file.
    • ✔️ has a 'contributing' file.
    • ✔️ uses 'roxygen2'.
    • ✔️ 'DESCRIPTION' has a URL field.
    • ✔️ 'DESCRIPTION' has a BugReports field.
    • ✔️ Package has at least one HTML vignette
    • ✔️ All functions have examples.
    • ✔️ Package has continuous integration checks.
    • ✔️ Package coverage is 100%.
    • ✔️ R CMD check found no errors.
    • ✔️ R CMD check found no warnings.

    Package License: GPL (>= 3)


    1. Package Dependencies

    Details of Package Dependency Usage (click to open)

    The table below tallies all function calls to all packages ('ncalls'), both internal (r-base + recommended, along with the package itself), and external (imported and suggested packages). 'NA' values indicate packages to which no identified calls to R functions could be found. Note that these results are generated by an automated code-tagging system which may not be entirely accurate.

    type package ncalls
    internal base 11
    internal datefixR 2
    internal stats 1
    imports stringr 1
    suggests rmarkdown NA
    suggests knitr NA
    suggests testthat NA
    linking_to NA NA

    Click below for tallies of functions used in each package. Locations of each call within this package may be generated locally by running 's <- pkgstats::pkgstats(<path/to/repo>)', and examining the 'external_calls' table.

    base

    date (3), for (3), paste0 (2), c (1), new.env (1), nrow (1)

    datefixR

    fix_date (2)

    stats

    df (1)

    stringr

    str_split_fixed (1)


    2. Statistical Properties

    This package features some noteworthy statistical properties which may need to be clarified by a handling editor prior to progressing.

    Details of statistical properties (click to open)

    The package has:

    • code in R (100% in 2 files) and
    • 1 authors
    • 1 vignette
    • no internal data file
    • 1 imported package
    • 2 exported functions (median 60 lines of code)
    • 24 non-exported functions in R (median 11 lines of code)

    Statistical properties of package structure as distributional percentiles in relation to all current CRAN packages
    The following terminology is used:

    • loc = "Lines of Code"
    • fn = "function"
    • exp/not_exp = exported / not exported

    All parameters are explained as tooltips in the locally-rendered HTML version of this report generated by the checks_to_markdown() function

    The final measure (fn_call_network_size) is the total number of calls between functions (in R), or more abstract relationships between code objects in other languages. Values are flagged as "noteworthy" when they lie in the upper or lower 5th percentile.

    measure value percentile noteworthy
    files_R 2 13.6
    files_vignettes 1 68.4
    files_tests 3 75.2
    loc_R 287 31.1
    loc_vignettes 126 32.9
    loc_tests 243 59.4
    num_vignettes 1 64.8
    n_fns_r 26 35.7
    n_fns_r_exported 2 6.8
    n_fns_r_not_exported 24 46.2
    n_fns_per_file_r 8 80.7
    num_params_per_fn 5 69.6
    loc_per_fn_r 12 38.9
    loc_per_fn_r_exp 60 84.1
    loc_per_fn_r_not_exp 12 38.4
    rel_whitespace_R 10 22.6
    rel_whitespace_vignettes 27 25.8
    rel_whitespace_tests 21 56.8
    doclines_per_fn_exp 48 60.4
    doclines_per_fn_not_exp 0 0.0 TRUE
    fn_call_network_size 21 47.5

    2a. Network visualisation

    Click to see the interactive network visualisation of calls between objects in package


    3. goodpractice and other checks

    Details of goodpractice and other checks (click to open)

    3a. Continuous Integration Badges

    R-CMD-check | DOI | R build status

    GitHub Workflow Results

    name conclusion sha date
    pages build and deployment success b11eed 2022-04-29
    pkgdown success 551313 2022-04-29
    R-CMD-check success 551313 2022-04-29

    3b. goodpractice results

    R CMD check with rcmdcheck

    rcmdcheck found no errors, warnings, or notes

    Test coverage with covr

    Package coverage: 100

    Cyclocomplexity with cyclocomp

    The following function have cyclocomplexity >= 15:

    function cyclocomplexity
    fix_date 35

    Static code analyses with lintr

    lintr found the following 4 potential issues:

    message number of times
    Avoid 1:nrow(...) expressions, use seq_len. 1
    Lines should not be more than 80 characters. 3


    Package Versions

    package version
    pkgstats 0.0.4.30
    pkgcheck 0.0.3.11


    Editor-in-Chief Instructions:

    This package is in top shape and may be passed on to a handling editor

  4. self-assigned this
    on Apr 30, 2022
  5. removed their assignment
    on May 1, 2022
  6. jooolia commented on May 1, 2022

    @jooolia
    Member
  7. ropensci-review-bot commented on May 1, 2022

    @ropensci-review-bot
    Collaborator

    Assigned! @adamhsparks is now the editor

  8. adamhsparks commented on May 4, 2022

    @adamhsparks
    Member

    Hi @nathansam, could you address the issues lintr found, Avoid 1:nrow(...) expressions, use seq_len. and the lines of code >80 chars, please?

    While you're doing that I'll start looking for reviewers.

  9. adamhsparks commented on May 4, 2022

    @adamhsparks
    Member

    @ropensci-review-bot seeking reviewers

  10. ropensci-review-bot commented on May 4, 2022

    @ropensci-review-bot
    Collaborator

    Please add this badge to the README of your package repository:

    [![Status at rOpenSci Software Peer Review](https://badges.ropensci.org/533_status.svg)](https://github.com/ropensci/software-review/issues/533)

    Furthermore, if your package does not have a NEWS.md file yet, please create one to capture the changes made during the review process. See https://devguide.ropensci.org/releasing.html#news

  11. 41 remaining items

  12. adamhsparks commented on Jul 16, 2022

    @adamhsparks
    Member

    Thanks, @alstat for finalising that.

    @alstat and @AlvesKS, please let us know when you're satisfied with the changes or if you would prefer more.

  13. alstat commented on Jul 16, 2022

    @alstat

    I'm satisfied with the changes here, both issues I opened were addressed.

  14. AlvesKS commented on Jul 16, 2022

    @AlvesKS

    Hi @adamhsparks,

    I am also satisfied with the changes.
    The author has done a great job addressing the suggestions I made.
    Congratulations @nathansam!

    Kaique

  15. adamhsparks commented on Jul 16, 2022

    @adamhsparks
    Member

    @ropensci-review-bot approve datefixR

  16. ropensci-review-bot commented on Jul 16, 2022

    @ropensci-review-bot
    Collaborator

    Approved! Thanks @nathansam for submitting and @AlvesKS, @alstat for your reviews! 😁

    To-dos:

    • Transfer the repo to rOpenSci's "ropensci" GitHub organization under "Settings" in your repo. I have invited you to a team that should allow you to do so. You will need to enable two-factor authentication for your GitHub account.
      This invitation will expire after one week. If it happens write a comment @ropensci-review-bot invite me to ropensci/<package-name> which will re-send an invitation.
    • After transfer write a comment @ropensci-review-bot finalize transfer of <package-name> where <package-name> is the repo/package name. This will give you admin access back.
    • Fix all links to the GitHub repo to point to the repo under the ropensci organization.
    • Delete your current code of conduct file if you had one since rOpenSci's default one will apply, see https://devguide.ropensci.org/collaboration.html#coc-file
    • If you already had a pkgdown website and are ok relying only on rOpenSci central docs building and branding,
      • deactivate the automatic deployment you might have set up
      • remove styling tweaks from your pkgdown config but keep that config file
      • replace the whole current pkgdown website with a redirecting page
      • replace your package docs URL with https://docs.ropensci.org/package_name
      • In addition, in your DESCRIPTION file, include the docs link in the URL field alongside the link to the GitHub repository, e.g.: URL: https://docs.ropensci.org/foobar, https://github.com/ropensci/foobar
    • Fix any links in badges for CI and coverage to point to the new repository URL.
    • Increment the package version to reflect the changes you made during review. In NEWS.md, add a heading for the new version and one bullet for each user-facing change, and each developer-facing change that you think is relevant.
    • We're starting to roll out software metadata files to all rOpenSci packages via the Codemeta initiative, see https://docs.ropensci.org/codemetar/ for how to include it in your package, after installing the package - should be easy as running codemetar::write_codemeta() in the root of your package.
    • You can add this installation method to your package README install.packages("<package-name>", repos = "https://ropensci.r-universe.dev") thanks to R-universe.

    Should you want to acknowledge your reviewers in your package DESCRIPTION, you can do so by making them "rev"-type contributors in the Authors@R field (with their consent).

    Welcome aboard! We'd love to host a post about your package - either a short introduction to it with an example for a technical audience or a longer post with some narrative about its development or something you learned, and an example of its use for a broader readership. If you are interested, consult the blog guide, and tag @ropensci/blog-editors in your reply. They will get in touch about timing and can answer any questions.

    We maintain an online book with our best practice and tips, this chapter starts the 3d section that's about guidance for after onboarding (with advice on releases, package marketing, GitHub grooming); the guide also feature CRAN gotchas. Please tell us what could be improved.

    Last but not least, you can volunteer as a reviewer via filling a short form.

  17. adamhsparks commented on Jul 16, 2022

    @adamhsparks
    Member

    Thank you, @AlvesKS and @alstat for your kind and insightful reviews. I hope you found this experience useful and enjoyable. @nathansam, thank you for submitting datefixR. You can transfer it to rOpenSci now.

  18. nathansam commented on Jul 16, 2022

    @nathansam
    Author

    Thank you @AlvesKS and @alstat, your reviews were immeasurably helpful! I am of course more than happy to acknowledge you both as reviewers in DESCRIPTION. I have added your details based on the DESCRIPTION files for your own packages. Please let me know if you would like any edits made to your listings in the description.
    https://github.com/nathansam/datefixR/blob/3a2b33b657c19fce085f57ac23a831f043838da8/DESCRIPTION

    Thank you @adamhsparks for your editorship throughout and for the issues you have opened. I will begin the process of migrating datefixR to the ropensci organization now.

  19. nathansam commented on Jul 16, 2022

    @nathansam
    Author

    @ropensci-review-bot finalize transfer of datefixR

  20. ropensci-review-bot commented on Jul 16, 2022

    @ropensci-review-bot
    Collaborator

    Transfer completed.
    The datefixR team is now owner of the repository and the author has been invited to the team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions