From dac67751f133d9b7bb32624d2a27e31f3d14ee79 Mon Sep 17 00:00:00 2001 From: "Thomas J. Leeper" Date: Mon, 12 Jun 2017 12:25:44 +0100 Subject: [PATCH] fix NAMESPACE issues --- .travis.yml | 1 + DESCRIPTION | 2 ++ NAMESPACE | 2 ++ R/SWORD.R | 3 ++- R/dataset_metadata.R | 1 + R/dataverse_search.R | 2 +- R/print.R | 1 + R/utils_atom.R | 2 +- man/dataverse_search.Rd | 2 +- 9 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa4b756..7ec24c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ matrix: r_packages: - covr +- knitr after_success: - if [[ "${R_CODECOV}" ]]; then R -e 'covr::codecov()'; fi diff --git a/DESCRIPTION b/DESCRIPTION index 7f0bd88..4ac6fe2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,6 +7,7 @@ Authors@R: c(person("Thomas J.", "Leeper", role = c("aut", "cre"), person("Jan", "Kanis", role = "ctb")) Maintainer: Thomas J. Leeper Imports: + stats, utils, httr, XML, @@ -23,4 +24,5 @@ Description: Provides access to Dataverse version 4 APIs, enabling data search, License: GPL-2 URL: https://github.com/iqss/dataverse-client-r BugReports: https://github.com/iqss/dataverse-client-r/issues +VignetteBuilder: knitr RoxygenNote: 6.0.1 diff --git a/NAMESPACE b/NAMESPACE index af97f89..87aed92 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -52,5 +52,7 @@ export(service_document) export(set_dataverse_metadata) export(update_dataset) export(update_group) +importFrom(stats,setNames) +importFrom(utils,str) importFrom(utils,unzip) importFrom(xml2,read_xml) diff --git a/R/SWORD.R b/R/SWORD.R index 6d5afef..43c776b 100644 --- a/R/SWORD.R +++ b/R/SWORD.R @@ -13,6 +13,7 @@ #' # list available datasets in first dataverse #' list_datasets(d[[2]]) #' } +#' @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") @@ -35,7 +36,7 @@ service_document <- function(key = Sys.getenv("DATAVERSE_KEY"), server = Sys.get s$alias <- strsplit(s$url, "/collection/dataverse/")[[1]][2] out[[length(out) + 1]] <- s } - out <- setNames(out, `[<-`(names(out), n, "dataverse")) + out <- stats::setNames(out, `[<-`(names(out), n, "dataverse")) structure(out, class = "sword_service_document") } diff --git a/R/dataset_metadata.R b/R/dataset_metadata.R index ba1d40b..ef5e8b5 100644 --- a/R/dataset_metadata.R +++ b/R/dataset_metadata.R @@ -19,6 +19,7 @@ #' # get metadata #' str(dataset_metadata(d1), 4) #' } +#' @importFrom utils str #' @export dataset_metadata <- function(dataset, version = ":latest", block = "citation", key = Sys.getenv("DATAVERSE_KEY"), server = Sys.getenv("DATAVERSE_SERVER"), ...) { dataset <- dataset_id(dataset) diff --git a/R/dataverse_search.R b/R/dataverse_search.R index 51f503b..321182e 100644 --- a/R/dataverse_search.R +++ b/R/dataverse_search.R @@ -10,7 +10,7 @@ #' @param per_page An integer specifying the page size of results. #' @param start An integer specifying used for pagination. #' @param show_relevance A logical indicating whether or not to show details of which fields were matched by the query -#' @param show_facets A logical indicating whether or not to show facets that can be operated on by the “fq” parameter +#' @param show_facets A logical indicating whether or not to show facets that can be operated on by the \code{fq} parameter #' @param fq See API documentation. #' @template envvars #' @param verbose A logical indicating whether to display information about the search query (default is \code{TRUE}). diff --git a/R/print.R b/R/print.R index 3ada5d3..4ecc3cb 100644 --- a/R/print.R +++ b/R/print.R @@ -33,6 +33,7 @@ print.dataverse <- function(x, ...) { } # dataverse_dataset class +#' @importFrom utils str #' @export print.dataverse_dataset <- function(x, ...) { cat("Dataset (", x$id, "): ", x$persistentUrl, "\n", sep = "") diff --git a/R/utils_atom.R b/R/utils_atom.R index f6e491e..984d7c4 100644 --- a/R/utils_atom.R +++ b/R/utils_atom.R @@ -14,7 +14,7 @@ print.dataset_atom <- function(x, ...) { parse_atom <- function(xml){ xmllist <- XML::xmlToList(xml) links <- lapply(xmllist[names(xmllist) == "link"], function(x) as.vector(x[1])) - links <- setNames(links, sapply(xmllist[names(xmllist) == "link"], `[`, 2)) + links <- stats::setNames(links, sapply(xmllist[names(xmllist) == "link"], `[`, 2)) names(links)[grep("statement$", names(links))] <- "statement" names(links)[grep("add$", names(links))] <- "add" xmlout <- list(id = xmllist$id, diff --git a/man/dataverse_search.Rd b/man/dataverse_search.Rd index 1352a82..81400b4 100644 --- a/man/dataverse_search.Rd +++ b/man/dataverse_search.Rd @@ -28,7 +28,7 @@ dataverse_search(..., type = c("dataverse", "dataset", "file"), \item{show_relevance}{A logical indicating whether or not to show details of which fields were matched by the query} -\item{show_facets}{A logical indicating whether or not to show facets that can be operated on by the “fq” parameter} +\item{show_facets}{A logical indicating whether or not to show facets that can be operated on by the \code{fq} parameter} \item{fq}{See API documentation.}