From cc2d0c403d911d5eb7ae74c45f29dc08a55ae960 Mon Sep 17 00:00:00 2001 From: keberwein Date: Thu, 14 Mar 2024 18:41:26 -0400 Subject: [PATCH] CRAN bump 4.0.1 --- DESCRIPTION | 4 +-- NAMESPACE | 3 --- NEWS.md | 8 ++++++ R/set_bls_key.R | 66 ---------------------------------------------- README.md | 19 ------------- cran-comments.md | 31 ++++++++++++++++++++-- man/firstupper.Rd | 2 +- man/set_bls_key.Rd | 42 ----------------------------- 8 files changed, 40 insertions(+), 135 deletions(-) delete mode 100644 R/set_bls_key.R delete mode 100644 man/set_bls_key.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 92638e1..f6a74c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,10 +1,10 @@ Package: blscrapeR Type: Package Title: An API Wrapper for the United States Bureau of Labor Statistics -Version: 4.0.0 +Version: 4.0.1 Authors@R: person("Kris", "Eberwein", email = "kris.eberwein@gmail.com", role = c("aut", "cre")) -Description: Scrapes various data from United States Bureau of Labor Statistics. The Bureau of Labor Statistics is the statistical branch of the United States Department of Labor. The package has additional functions to help parse, analyze and visualize the data. +Description: Scrapes various data from . The Bureau of Labor Statistics is the statistical branch of the United States Department of Labor. The package has additional functions to help parse, analyze and visualize the data. Depends: R (>= 3.5.0) Imports: httr, diff --git a/NAMESPACE b/NAMESPACE index 60563fc..05cebf8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -15,7 +15,6 @@ export(quick_nonfarm_employed) export(quick_unemp_level) export(quick_unemp_rate) export(search_ids) -export(set_bls_key) export(urlExists) importFrom(dplyr,arrange) importFrom(dplyr,filter) @@ -38,5 +37,3 @@ importFrom(stringr,str_to_title) importFrom(stringr,str_trim) importFrom(tibble,as_tibble) importFrom(utils,capture.output) -importFrom(utils,read.table) -importFrom(utils,write.table) diff --git a/NEWS.md b/NEWS.md index 8ace721..61fbf42 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,11 @@ +# blscrapeR 4.0.1 + +## Bug Fixes + +* Added the API address to the Description file. + +* Removed the `set_bls_key()` function to remain in compliance with CRAN policies. + # blscrapeR 4.0.0 ## Bug Fixes diff --git a/R/set_bls_key.R b/R/set_bls_key.R deleted file mode 100644 index be5dba2..0000000 --- a/R/set_bls_key.R +++ /dev/null @@ -1,66 +0,0 @@ -# -#' @title Install a BLS API Key in Your \code{.Renviron} File for Repeated Use -#' @description This function will add your BLS API key to your \code{.Renviron} file so it can be called securely without being stored -#' in your code. After you have installed your key, it can be called any time by typing \code{Sys.getenv("BLS_KEY")} and can be -#' used in package functions by simply typing BLS_KEY. If you do not have an \code{.Renviron} file, the function will create on for you. -#' If you already have an \code{.Renviron} file, the function will append the key to your existing file, while making a backup of your -#' original file for disaster recovery purposes. -#' @param key The API key provided to you from the BLS formatted in quotes. A key can be acquired at \url{https://data.bls.gov/registrationEngine/} -#' @param overwrite If this is set to TRUE, it will overwrite an existing BLS_KEY that you already have in your \code{.Renviron} file. -#' @importFrom utils write.table read.table -#' @export set_bls_key -#' @return No return value. A convenience function used for API Key configuration. -#' @examples -#' -#' \dontrun{ -#' set_bls_key("111111abc") -#' # First time, reload your environment so you can use the key without restarting R. -#' readRenviron("~/.Renviron") -#' # You can check it with: -#' Sys.getenv("BLS_KEY") -#' } -#' -#' \dontrun{ -#' # If you need to overwrite an existing key: -#' set_bls_key("111111abc", overwrite = TRUE) -#' # First time, reload your environment so you can use the key without restarting R. -#' readRenviron("~/.Renviron") -#' # You can check it with: -#' Sys.getenv("BLS_KEY") -#' } - -set_bls_key <- function(key=NA, overwrite=NA){ - # Get working dir so we can change it back later, if needed. - oldwd <- getwd() - on.exit(setwd(oldwd)) - # go to the home dir. and look for an .Renviron file. If not, create one. - setwd(Sys.getenv("HOME")) - if(file.exists(".Renviron")){ - # Backup original .Renviron before doing anything else here. - file.copy(".Renviron", ".Renviron_backup") - } - if(!file.exists(".Renviron")){ - file.create(".Renviron") - } - else{ - if(isTRUE(overwrite)){ - message("Your original .Renviron will be backed up and stored in your R HOME directory if needed.") - oldenv=read.table(".Renviron", stringsAsFactors = FALSE) - newenv <- oldenv[-grep("BLS_KEY", oldenv),] - write.table(newenv, ".Renviron", quote = FALSE, sep = "\n", - col.names = FALSE, row.names = FALSE) - } - else{ - tv <- readLines(".Renviron") - if(isTRUE(any(grepl("BLS_KEY",tv)))){ - stop("A BLS_KEY already exists. You can overwrite it with the argument overwrite=TRUE", call.=FALSE) - } - } - } - - keyconcat <- paste("BLS_KEY=","'",key,"'", sep = "") - # Append API key to .Renviron file - write(keyconcat, ".Renviron", sep = "\n", append = TRUE) - message('Your API key has been stored in your .Renviron and can be accessed by Sys.getenv("BLS_KEY")') - return(key) -} diff --git a/README.md b/README.md index ef41db3..b1fcfb7 100644 --- a/README.md +++ b/README.md @@ -95,25 +95,6 @@ You should consider [getting an API key](http://data.bls.gov/registrationEngine/ | Optional annual averages | Yes | No | | Series descriptions | Yes | No | -### Key Install - -``` r -library(blscrapeR) -set_bls_key("YOUR_KEY_IN_QUOTATIONS") -# First time, reload your enviornment so you can use the key without restarting R. -readRenviron("~/.Renviron") -# You can check it with: -Sys.getenv("BLS_KEY") -``` - -Note: The above script will add a line to your `.Renviron` file to be re-used when ever you are in the package. If you are not comfortable with that, you can add the following line to your `.Renviron` file manually to produce the same result. - -`BLS_KEY='YOUR_KEY_IN_SINGLE_QUOTES'` - -Advanced Usage --------------- - -Now that you have an API key installed, you can call your key in the package’s function arguments with `"BLS_KEY"`. Don't forget the quotes! If you just HAVE to have your key hard-coded in your scripts, you can also pass they key as a string. ### Download Multiple BLS Series at Once diff --git a/cran-comments.md b/cran-comments.md index 89686aa..d6d926a 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,11 @@ +## Resubmission +Corrected two items of concern by CRAN review. + +* Added the API address to the Description file. + +* Removed the `set_bls_key()` function to remain in compliance with CRAN policies regarding writing files to user space. Also, removed any mention of the function from documentation and vignettes. + + ## Test environments * local Fedora 33, R 4.05 * win-latest (devel) @@ -7,6 +15,25 @@ ## R CMD check results -0 errors | 0 warnings | 1 note +0 errors | 0 warnings | 2 notes + +## Notes: +CRAN repository db overrides: + X-CRAN-Comment: Archived on 2023-02-07 for repeated policy violation. + + * This package was previously archived due to CRAN violations, which have all been fixed. The violations regarded bad URL links in documentation and vignettes. + + +Found the following (possibly) invalid URLs: + URL: https://www.bls.gov/ + From: DESCRIPTION + Status: 403 + Message: Forbidden + + * The following note was generated when I added the BLS url to the DESCRIPTION file as requested by CRAN reviewer. The url is valid. + + + + + -* This is a new release. \ No newline at end of file diff --git a/man/firstupper.Rd b/man/firstupper.Rd index 5b9e8df..7654aa1 100644 --- a/man/firstupper.Rd +++ b/man/firstupper.Rd @@ -7,7 +7,7 @@ firstupper(x, ...) } \arguments{ -\item{x}{A word or string to capatalize} +\item{x}{A word or string to capitalize} \item{...}{additional arguments.} } diff --git a/man/set_bls_key.Rd b/man/set_bls_key.Rd deleted file mode 100644 index 8688aa1..0000000 --- a/man/set_bls_key.Rd +++ /dev/null @@ -1,42 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set_bls_key.R -\name{set_bls_key} -\alias{set_bls_key} -\title{Install a BLS API Key in Your \code{.Renviron} File for Repeated Use} -\usage{ -set_bls_key(key = NA, overwrite = NA) -} -\arguments{ -\item{key}{The API key provided to you from the BLS formatted in quotes. A key can be acquired at \url{https://data.bls.gov/registrationEngine/}} - -\item{overwrite}{If this is set to TRUE, it will overwrite an existing BLS_KEY that you already have in your \code{.Renviron} file.} -} -\value{ -No return value. A convenience function used for API Key configuration. -} -\description{ -This function will add your BLS API key to your \code{.Renviron} file so it can be called securely without being stored -in your code. After you have installed your key, it can be called any time by typing \code{Sys.getenv("BLS_KEY")} and can be -used in package functions by simply typing BLS_KEY. If you do not have an \code{.Renviron} file, the function will create on for you. -If you already have an \code{.Renviron} file, the function will append the key to your existing file, while making a backup of your -original file for disaster recovery purposes. -} -\examples{ - -\dontrun{ -set_bls_key("111111abc") -# First time, reload your environment so you can use the key without restarting R. -readRenviron("~/.Renviron") -# You can check it with: -Sys.getenv("BLS_KEY") -} - -\dontrun{ -# If you need to overwrite an existing key: -set_bls_key("111111abc", overwrite = TRUE) -# First time, reload your environment so you can use the key without restarting R. -readRenviron("~/.Renviron") -# You can check it with: -Sys.getenv("BLS_KEY") -} -}