Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nx10
Copy link
Contributor

@nx10 nx10 commented Oct 1, 2022

Hi,

just a quick PR for hacktoberfest.

#72 mentions the use of .onLoad and .onAttach to update the data system files:

This is very unusual behavior for an R package. Although I don't know of any official documentation mentioning this, but a package should probably not modify it's own files after installation. This PR realizes a different approach to solve this:

The (internal) functions GetWQXCharValRef() and GetMeasureUnitRef() are introduced to lazily fetch and return the newest tables on demand. This means that they will cache the tables after downloading once (per session) to improve performance. No data is downloaded when none of them are called. If the download is unavailable (e.g. no internet connection) the internal tables are returned (and the user is notified).

Functions UpdateWQXCharValRef() and UpdateMeasureUnitRef() are still available to update the static project files (I assume this is what you used them for).

Cheers,
Florian

@cristinamullin cristinamullin self-assigned this Oct 4, 2022
@cristinamullin
Copy link
Collaborator

Hi Florian, thank you for taking on this issue and for the elegant solution! Great work

@cristinamullin cristinamullin merged commit 83e6b85 into USEPA:develop Oct 4, 2022
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.

2 participants