diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2a3b047..4df0786 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,7 +29,7 @@ jobs: - uses: r-lib/actions/setup-tinytex@v1 - name: Cache R packages - uses: actions/cache@v1 + uses: actions/cache@v4 if: runner.os != 'Windows' with: path: ${{ env.R_LIBS_USER }} diff --git a/DESCRIPTION b/DESCRIPTION index ceaaa23..9d2bb37 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,8 @@ Authors@R: c( person("Robyn", "Thiessen-Bock", email = "robyn.thiessenbock@gmail.com", role = "ctb"), person("Derek", "Strong", email = "dstrong@nceas.ucsb.edu", role = "ctb"), person("Rachel", "Sun", email = "rachelsun@ucsb.edu", role = "ctb"), - person("Jasmine", "Lai", email = "jasminelai@nceas.ucsb.edu", role = "ctb") + person("Jasmine", "Lai", email = "jasminelai@nceas.ucsb.edu", role = "ctb"), + person("Justin", "Kadi", email = "jeakadi@nceas.ucsb.edu", role = "ctb") ) Description: A set of utilities for working with the Arctic Data Center (https://arcticdata.io). @@ -33,6 +34,7 @@ Imports: magrittr, methods, filelock, + raster, stringr, stringi, tools, @@ -51,13 +53,12 @@ Suggests: ncdf4, RCurl, purrr, - raster, rmarkdown, sf, testthat (>= 3.0.0), xslt, yaml -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.3 Roxygen: list(markdown = TRUE) VignetteBuilder: knitr Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index 0b9b1f1..4d15410 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -77,6 +77,7 @@ import(EML) import(XML) import(dataone) import(datapack) +import(raster) importFrom(httr,content) importFrom(magrittr,'%>%') importFrom(methods,"slot<-") diff --git a/R/eml.R b/R/eml.R index 84c12d4..b25d4dd 100644 --- a/R/eml.R +++ b/R/eml.R @@ -444,13 +444,19 @@ extract_name <- function(x){ lapply(x, function(x) { data.frame( firstName = unlist(lapply(x, function(x){head(strsplit(x, split = " ")[[1]], 1)})), - lastName = unlist(lapply(x, function(x) {paste(tail(strsplit(x, split = " ")[[1]], -1), collapse = " ")})) + lastName = unlist(lapply(x, function(x) { + paste( + head( + tail( + strsplit(x, split = " ")[[1]], + -1), + -1), + collapse = " ") + })) ) }) } - - #' Get raster info from a file on disk #' #' This function populates a spatialRaster element with the @@ -463,7 +469,7 @@ extract_name <- function(x){ #' @param coord_name (char) horizCoordSysDef name #' @param attributes (dataTable) attributes for raster #' -#' +#' @import raster #' @export eml_get_raster_metadata <- function(path, coord_name = NULL, attributes){ diff --git a/man/arcticdatautils.Rd b/man/arcticdatautils.Rd index 5d38fd9..d0a4870 100644 --- a/man/arcticdatautils.Rd +++ b/man/arcticdatautils.Rd @@ -2,9 +2,35 @@ % Please edit documentation in R/arcticdatautils.R \docType{package} \name{arcticdatautils} +\alias{arcticdatautils-package} \alias{arcticdatautils} \title{arcticdatautils: Utilities for the Arctic Data Center} \description{ This package contains code for doing lots of useful stuff that's too specific for the dataone package, primarily functions that streamline Arctic Data Center operations. } +\seealso{ +Useful links: +\itemize{ + \item \url{https://nceas.github.io/arcticdatautils/} + \item Report bugs at \url{https://github.com/NCEAS/arcticdatautils/issues} +} + +} +\author{ +\strong{Maintainer}: Bryce Mecum \email{mecum@nceas.ucsb.edu} + +Other contributors: +\itemize{ + \item Matt Jones \email{jones@nceas.ucsb.edu} [contributor] + \item Jesse Goldstein \email{jgoldstein@nceas.ucsb.edu} (Maintainer) [contributor] + \item Jeanette Clark \email{jclark@nceas.ucsb.edu} (Maintainer) [contributor] + \item Dominic Mullen \email{dmullen17@gmail.com} [contributor] + \item Emily O'Dean \email{eodean10@gmail.com} [contributor] + \item Robyn Thiessen-Bock \email{robyn.thiessenbock@gmail.com} [contributor] + \item Derek Strong \email{dstrong@nceas.ucsb.edu} [contributor] + \item Rachel Sun \email{rachelsun@ucsb.edu} [contributor] + \item Jasmine Lai \email{jasminelai@nceas.ucsb.edu} [contributor] +} + +} diff --git a/tests/testthat/test_access.R b/tests/testthat/test_access.R index 8b2f8ba..1651cff 100644 --- a/tests/testthat/test_access.R +++ b/tests/testthat/test_access.R @@ -1,5 +1,3 @@ -context("Access rules") - mn <- tryCatch(env_load()$mn, error = function(e) env_load()$mn) test_that("get_package works for a simple package", { diff --git a/tests/testthat/test_dataone.R b/tests/testthat/test_dataone.R index 6caa830..eaa243e 100644 --- a/tests/testthat/test_dataone.R +++ b/tests/testthat/test_dataone.R @@ -1,5 +1,3 @@ -context("Helpers for the dataone package") - node <- env_load()$mn test_that("permissions can be checked", { diff --git a/tests/testthat/test_editing.R b/tests/testthat/test_editing.R index 8a029ea..6f07b16 100644 --- a/tests/testthat/test_editing.R +++ b/tests/testthat/test_editing.R @@ -1,5 +1,3 @@ -context("Editing and managing data packages") - mn <- env_load()$mn test_that("we can publish an update", { diff --git a/tests/testthat/test_eml.R b/tests/testthat/test_eml.R index aa035df..f3634d4 100644 --- a/tests/testthat/test_eml.R +++ b/tests/testthat/test_eml.R @@ -1,5 +1,3 @@ -context("EML") - mn <- env_load()$mn test_that("a dataTable and otherEntity can be added from a pid", { @@ -272,9 +270,12 @@ test_that('eml_nsf_to_project generates a valid project section', { test_that('eml_nsf_to_project handles bad funding numbers gracefully', { - awards <- c("abcdef", "1203473", "12345") + awards <- c("1203473", "12345") - expect_warning(proj <- eml_nsf_to_project(awards), "this award will not be included in the project section") + # test to be sure that missing award numbers generates warning + expect_warning(proj <- eml_nsf_to_project(awards), class="warning") + # test to be sure that a list with no valid award number generates error + expect_error(expect_warning(proj <- eml_nsf_to_project(c("abcdef")))) me <- list(individualName = list(givenName = "Jeanette", surName = "Clark")) diff --git a/tests/testthat/test_environment.R b/tests/testthat/test_environment.R index ba42e7a..592ef65 100644 --- a/tests/testthat/test_environment.R +++ b/tests/testthat/test_environment.R @@ -1,5 +1,3 @@ -context("Environment") - test_that("can load a simple environment file", { x <- yaml::yaml.load_file(system.file("./environment.yml", package = "arcticdatautils")) diff --git a/tests/testthat/test_formats.R b/tests/testthat/test_formats.R index 3cbb06c..7069daf 100644 --- a/tests/testthat/test_formats.R +++ b/tests/testthat/test_formats.R @@ -1,5 +1,3 @@ -context("Formats") - test_that("valid formats are valid and invalid ones are not", { expect_true(check_format("text/csv")) expect_error(check_format("badformat")) diff --git a/tests/testthat/test_helpers.R b/tests/testthat/test_helpers.R index 7b446fe..b931455 100644 --- a/tests/testthat/test_helpers.R +++ b/tests/testthat/test_helpers.R @@ -1,5 +1,3 @@ -context("Helpers") - mn <- env_load()$mn test_that("a dummy package can be created", { diff --git a/tests/testthat/test_packaging.R b/tests/testthat/test_packaging.R index b65a06b..ce0e415 100644 --- a/tests/testthat/test_packaging.R +++ b/tests/testthat/test_packaging.R @@ -1,5 +1,3 @@ -context("Packaging") - test_that("child pids are correctly determined", { inventory <- data.frame(pid = c("A", "B", "C"), package = c("PA", "PB", "PC"), diff --git a/tests/testthat/test_sysmeta.R b/tests/testthat/test_sysmeta.R index 49ab9f3..6e227b8 100644 --- a/tests/testthat/test_sysmeta.R +++ b/tests/testthat/test_sysmeta.R @@ -1,5 +1,3 @@ -context("System metadata") - test_that("the replication policy gets cleared", { library(datapack) diff --git a/tests/testthat/test_util.R b/tests/testthat/test_util.R index 5f0fd2a..853e84e 100644 --- a/tests/testthat/test_util.R +++ b/tests/testthat/test_util.R @@ -1,5 +1,3 @@ -context("Utilities") - test_that("paths can be joined", { expect_equal(path_join(""), "") expect_equal(path_join(1), "1")