-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed all functions to use rappdirs instead of writing to users home dir cleaned up some code too in terms of line length and prettiness - storm_data now giving back a tibble instead of a data.frame within a list
- Loading branch information
Showing
29 changed files
with
506 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
#' Clear cached files | ||
#' | ||
#' @name caching | ||
#' @param path Path to location of cached files. Defaults to \code{disk()$path} | ||
#' @param force (logical) Should we force removal of files if permissions say otherwise? | ||
#' @param force (logical) Should we force removal of files if permissions | ||
#' say otherwise?. Default: \code{FALSE} | ||
#' | ||
#' @details BEWARE: this will clear all cached files. | ||
#' | ||
#' @section File storage: | ||
#' We use \pkg{rappdirs} to store files, see | ||
#' \code{\link[rappdirs]{user_cache_dir}} for how | ||
#' we determine the directory on your machine to save files to, and run | ||
#' \code{user_cache_dir("rnoaa")} to get that directory. | ||
|
||
#' @export | ||
#' @rdname caching | ||
ghcnd_clear_cache <- function(path = "~/.rnoaa/ghcnd", force = FALSE) { | ||
ghcnd_clear_cache <- function(force = FALSE) { | ||
calls <- names(sapply(match.call(), deparse))[-1] | ||
calls_vec <- "path" %in% calls | ||
if (any(calls_vec)) { | ||
stop("The parameter path has been removed, see ?ghcnd_clear_cache", | ||
call. = FALSE) | ||
} | ||
|
||
path <- file.path(rnoaa_cache_dir, "ghcnd") | ||
files <- list.files(path, full.names = TRUE) | ||
unlink(files, recursive = TRUE, force = force) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.