Skip to content

godataR v3.0.0

Latest
Compare
Choose a tag to compare
@sarahollis sarahollis released this 15 May 08:23
· 1 commit to main since this release
ba1f8a8

This release contains a number new functions and simplified syntax to enhance user experience. Modifications are listed below::

Package maintenance

  • Use up-to-date tidyverse styles (data-masking and tidy-select). This ensures the best practises of the tidyverse are implemented and that the developments of tidyverse packages (e.g. {dplyr}, {tidyr}) are being fully utilised.
  • change output to consistently use tibbles. This provides a cleaner output for users to view the output of functions, especially in cases when the API returns tabular data with many columns and/or rows.
  • removed function argument defaults that are recursive (i.e. equal to the name of the argument). Supplying an (potentially undefined) variable as an argument default to a function will result in an error when the user does not supply this argument when calling the function. This error will most likely look like this: promise already under evaluation: recursive default argument reference or earlier problems? which is not very intuitive especially for a new R users. By removing the recursive argument defaults this will resolve this issue.
  • removed pipe operator (%>%) from functions. This makes the code more modular and can improve debugging.
  • Use explicit namespaces in functions instead of importFrom in function documentation. The choice of using explicit namespacing instead of importing a package in the documentation is subjective, but the benefit of the namespacing is it makes clear which functions come from other packages and which are in {godataR}.
  • Linted the style of the package (using devtools::lint()). This is a style guide set out by the tidyverse team. The use of a consistent, widely used, code style makes it easier to read the code and is likely easier for people to contribute given they are likely familiar with the style. One future additon could be a style check within the package that checks future changes also conform to this style.

New functionality

  • Added translate_categories() function (exported), as well as translate_token() and any_tokens() functions (internal). These take the data returned by the API and use the language tokens (returned by get_language_tokens()) to translate hard to read strings to a simplier form given by the language tokens.
  • Added cleaning functions that previously stored as a cleaning script. Having the cleaning code as functions allows for better documentation, testing and distribution. It also allows the users of {godataR} to use the cleaning functions after importing data without have to access a separate script.

Testing

  • Testing infrastructure has been added to the package. The {testthat} unit testing framework was used as it is one of, if not the most use testing framework and provides lots of useful functions for testing. It also integrates nicely with {devtools} to run devtools::test() and devtools::check() to run tests.
  • Tests were added for API functions (get_*() functions). These are skipped by default as they require credential to connect to the the API. However, they can be run locally if a user has credientials.
  • Tests were added for non-API functions to check they work as expected.