Skip to content

Commit

Permalink
avoid @importFrom
Browse files Browse the repository at this point in the history
From https://r-pkgs.org/namespace.html#import-r

> If you are using just a few functions from another package, my recommendation is to note the package name in the Imports: field of the DESCRIPTION file and call the function(s) explicitly using ::, e.g., pkg::fun().

ref #41
  • Loading branch information
wibeasley committed Jan 2, 2021
1 parent 72c9baa commit 7e09a81
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,3 @@ export(update_dataset)
export(update_dataset_file)
import(httr)
import(xml2)
importFrom(readr,read_tsv)
importFrom(stats,setNames)
importFrom(utils,str)
2 changes: 1 addition & 1 deletion R/SWORD.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' list_datasets(d[[2]])
#' }
#' @seealso Managing a Dataverse: \code{\link{publish_dataverse}}; Managing a dataset: \code{\link{dataset_atom}}, \code{\link{list_datasets}}, \code{\link{create_dataset}}, \code{\link{delete_dataset}}, \code{\link{publish_dataset}}; Managing files within a dataset: \code{\link{add_file}}, \code{\link{delete_file}}
#' @importFrom stats setNames
#'
#' @export
service_document <- function(key = Sys.getenv("DATAVERSE_KEY"), server = Sys.getenv("DATAVERSE_SERVER"), ...) {
u <- paste0(api_url(server, prefix="dvn/api/"), "data-deposit/v1.1/swordv2/service-document")
Expand Down
7 changes: 2 additions & 5 deletions R/get_dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#'
#' @inheritDotParams get_file
#'
#' @importFrom readr read_tsv
#'
#' @examples
#'
#' # Retrieve data.frame from dataverse DOI and file name
Expand Down Expand Up @@ -86,7 +84,6 @@ get_dataframe_by_name <- function (
}

#' @rdname get_dataframe
#' @importFrom readr read_tsv
#' @export
get_dataframe_by_id <- function(
fileid,
Expand All @@ -103,8 +100,8 @@ get_dataframe_by_id <- function(
}

if (is.null(FUN) & isTRUE(ingested) & isFALSE(original)) {
message("Downloading ingested version of data with read_tsv. To download the original version and remove this message, set original = TRUE.\n")
FUN <- read_tsv
message("Downloading ingested version of data with readr::read_tsv. To download the original version and remove this message, set original = TRUE.\n")
FUN <- readr::read_tsv
}

if (is.null(FUN) & (isFALSE(ingested) | isTRUE(original))) {
Expand Down
2 changes: 1 addition & 1 deletion R/get_dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ get_dataset <- function(

#' @rdname get_dataset
#' @param block A character string specifying a metadata block to retrieve. By default this is \dQuote{citation}. Other values may be available, depending on the dataset, such as \dQuote{geospatial} or \dQuote{socialscience}.
#' @importFrom utils str
#'
#' @export
dataset_metadata <- function(
dataset,
Expand Down
1 change: 0 additions & 1 deletion R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ print.dataverse <- function(x, ...) {
}

# dataverse_dataset class
#' @importFrom utils str
#' @export
print.dataverse_dataset <- function(x, ...) {
cat("Dataset (", x$id, "): ", x$persistentUrl, "\n", sep = "")
Expand Down

0 comments on commit 7e09a81

Please sign in to comment.