Skip to content

Commit a55201c

Browse files
committed
sub onAttach/onLoad
1 parent 56ea405 commit a55201c

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

R/cancensus.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ cache_path <- function(...) {
818818
paste0(cache_dir, "/", ...)
819819
}
820820

821-
.onLoad <- function(libname, pkgname) {
821+
.onAttach <- function(libname, pkgname) {
822822
if (!"cancensus.api_key" %in% names(options())) {
823823
# Try to get the API key from the CM_API_KEY environment variable, if it has not already been specified.
824824
options(cancensus.api_key = if (nchar(Sys.getenv("CM_API_KEY")) > 1) { Sys.getenv("CM_API_KEY") } else { NULL })

cran-comments.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
## Update - v.0.1.7
22

3-
After initial acceptance, CRAN checks identified an issue stemming from the package using a local cache that writes to the user library rather than R's temporary director. Kurt Hornik advised to fix this and to submit an update. This update changes default caching behaviour to confirm with CRAN requirements. Users are prompted with a suggestion encouraging them to set up a persistent local cache on load, and a second reminder when making an API call.
3+
After initial acceptance, CRAN checks identified an issue stemming from the package using a local cache that writes to the user library rather than R's temporary director. Kurt Hornik advised to fix this and to submit an update.
44

5-
There is a NOTE generated by the startup message due to the startup message called via `.onLoad`.
6-
7-
```
8-
File ‘cancensus/R/cancensus.R’:
9-
.onLoad calls:
10-
packageStartupMessage(paste("Census data is currently stored temporarily.\n\n", "In order to speed up performance, reduce API quota usage, and reduce", "unnecessary network calls, please set up a persistent cache directory by", "setting options(cancensus.cache_path = '<path to cancensus cache directory>')\n\n", "You may add this option, together with your API key, to your .Rprofile."))
11-
12-
See section ‘Good practice’ in '?.onAttach'.
13-
```
5+
* This update changes default caching behaviour to confirm with CRAN requirements.
6+
* Users are prompted with a suggestion encouraging them to set up a persistent local cache on load, and a second reminder when making an API call.
147

158
## Resubmission - v.0.1.6 - Approved
169

0 commit comments

Comments
 (0)