From 5163b322ac609e0c6f55a70647274d4d8c42ab1e Mon Sep 17 00:00:00 2001 From: Mauro Lepore Date: Tue, 29 Jan 2019 17:35:32 -0600 Subject: [PATCH] Release 1.1.1 (#70) * Suggest not import fgeo.x * Remove has_table_names --- DESCRIPTION | 4 ++-- NAMESPACE | 2 ++ NEWS.md | 4 ++++ R/abund_index.R | 1 + R/abundance.R | 1 + R/add_cluster.R | 1 + R/demography_ctfs.R | 16 +++++++++------- R/fgeo_habitat.R | 2 ++ R/fgeo_topography.R | 4 ++++ R/has_table_names.R | 18 ------------------ R/imports.R | 5 +++++ R/summary.R | 2 ++ R/tt_test.R | 9 ++++++++- docs/news/index.html | 25 +++++++++++++++++++++---- man/abundance.Rd | 1 + man/fgeo_habitat.Rd | 2 ++ man/fgeo_topography.Rd | 2 ++ man/recruitment_ctfs.Rd | 2 ++ man/reexports.Rd | 5 ++++- man/summary.tt_df.Rd | 2 ++ man/tt_test.Rd | 1 + tests/testthat/test-has_table_names.R | 18 ------------------ 22 files changed, 76 insertions(+), 51 deletions(-) delete mode 100644 R/has_table_names.R delete mode 100644 tests/testthat/test-has_table_names.R diff --git a/DESCRIPTION b/DESCRIPTION index 7a843d5..7f3b711 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fgeo.analyze Title: Analyze ForestGEO Data -Version: 1.1.0 +Version: 1.1.1 Authors@R: c(person(given = "Mauro", family = "Lepore", @@ -55,7 +55,6 @@ Depends: Imports: dplyr, fgeo.tool, - fgeo.x, glue, graphics, grDevices, @@ -70,6 +69,7 @@ Imports: withr Suggests: covr, + fgeo.x, ggplot2, knitr, measurements, diff --git a/NAMESPACE b/NAMESPACE index 2914e9a..aa2d67d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,6 +18,7 @@ export("%>%") export(abundance) export(abundance_byyr) export(as_tibble) +export(assert_is_installed) export(basal_area) export(basal_area_byyr) export(fgeo_habitat) @@ -35,6 +36,7 @@ importFrom(dplyr,mutate) importFrom(dplyr,select) importFrom(dplyr,summarize) importFrom(dplyr,ungroup) +importFrom(fgeo.tool,assert_is_installed) importFrom(fgeo.tool,check_crucial_names) importFrom(fgeo.tool,is_duplicated) importFrom(fgeo.tool,is_multiple) diff --git a/NEWS.md b/NEWS.md index 2bda116..ecb7244 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,10 @@ * Work in progress. +# fgeo.analyze 1.1.1 (GitHub release) + +* fgeo.x no longer is imported but suggested. + # fgeo.analyze 1.1.0 (GitHub release) * Import fgeo packages via `Additional_repositories` served at diff --git a/R/abund_index.R b/R/abund_index.R index f80b790..c075419 100644 --- a/R/abund_index.R +++ b/R/abund_index.R @@ -19,6 +19,7 @@ #' is a rowname. #' #' @examples +#' assert_is_installed("fgeo.x") #' abund_index(fgeo.x::tree6, plotdim = c(1000, 500), gridsize = 20) #' @family functions for abundance and basal area #' @noRd diff --git a/R/abundance.R b/R/abundance.R index 9af82ae..c04e328 100644 --- a/R/abundance.R +++ b/R/abundance.R @@ -49,6 +49,7 @@ #' abundance(stem) #' \dontrun{ #' # Similar but more realistic +#' assert_is_installed("fgeo.x") #' stem <- fgeo.x::download_data("luquillo_stem5_random") #' #' abundance(stem) diff --git a/R/add_cluster.R b/R/add_cluster.R index c07cb5c..4c0265c 100644 --- a/R/add_cluster.R +++ b/R/add_cluster.R @@ -13,6 +13,7 @@ #' argument `k` to [stats::cutree()]). #' #' @examples +#' assert_is_installed("fgeo.x") #' elev_ls <- fgeo.x::elevation #' topo <- fgeo_topography(elev_ls, gridsize = 20) #' add_cluster(topo, n = 4) diff --git a/R/demography_ctfs.R b/R/demography_ctfs.R index 9ca9ddd..6c8b485 100644 --- a/R/demography_ctfs.R +++ b/R/demography_ctfs.R @@ -74,37 +74,39 @@ #' * `date2`, mean date in census 2. #' #' @examples +#' assert_is_installed("fgeo.x") +#' #' census1 <- fgeo.x::tree5 #' census2 <- fgeo.x::tree6 -#' +#' #' as_tibble( #' recruitment_ctfs(census1, census2) #' ) -#' +#' #' # Use `interaction(...)` to aggregate by any number of grouping variables #' sp_quadrat <- interaction(census1$sp, census1$quadrat) -#' +#' #' recruitment <- recruitment_ctfs( #' census1, census2, #' split1 = sp_quadrat, #' quiet = TRUE #' ) #' as_tibble(recruitment) -#' +#' #' mortality <- mortality_ctfs( #' census1, census2, #' split1 = sp_quadrat, quiet = TRUE #' ) #' as_tibble(mortality) -#' +#' #' growth <- growth_ctfs(census1, census2, split1 = sp_quadrat, quiet = TRUE) #' as_tibble(growth) -#' +#' #' # Easy way to separate grouping variables #' tidyr_is_installed <- requireNamespace("tidyr", quietly = TRUE) #' if (tidyr_is_installed) { #' library(tidyr) -#' +#' #' as_tibble(growth) %>% #' separate(groups, into = c("sp", "quadrat")) #' } diff --git a/R/fgeo_habitat.R b/R/fgeo_habitat.R index f2a83b6..914a321 100644 --- a/R/fgeo_habitat.R +++ b/R/fgeo_habitat.R @@ -20,6 +20,8 @@ #' as many distinct integer values as determined by the argument `n`. #' #' @examples +#' assert_is_installed("fgeo.x") +#' #' # Input a ForestGEO-like elevation list or dataframe #' elevation_ls <- fgeo.x::elevation #' habitats <- fgeo_habitat( diff --git a/R/fgeo_topography.R b/R/fgeo_topography.R index af8648d..a1783c2 100644 --- a/R/fgeo_topography.R +++ b/R/fgeo_topography.R @@ -18,6 +18,8 @@ #' Thanks to Jian Zhang for reporting a bug (issue 59). #' #' @examples +#' assert_is_installed("fgeo.x") +#' #' elev_list <- fgeo.x::elevation #' fgeo_topography(elev_list, gridsize = 20) #' @@ -102,6 +104,8 @@ abort_if_xdim_ydim_is_null <- function(xdim, ydim) { #' @seealso [calcslope()], [quadslope()] #' #' @examples +#' assert_is_installed("fgeo.x") +#' #' # The input to elev is very specific; you may need to tweak it. #' elev <- fgeo.x::elevation #' result <- allquadratslopes( diff --git a/R/has_table_names.R b/R/has_table_names.R deleted file mode 100644 index 3c76668..0000000 --- a/R/has_table_names.R +++ /dev/null @@ -1,18 +0,0 @@ -#' Factory of predicates to check if a table has the same names as a reference. -#' -#' @param reference A dataframe. -#' -#' @return A closure. -#' @examples -#' stem <- data.frame(x = 1, y = 1) -#' tree <- data.frame(x = 1, z = 1) -#' has_table_names(stem)(stem) -#' has_table_names(stem)(tree) -#' @family general predicates -#' @noRd -has_table_names <- function(reference) { - function(.data) { - has_expected_names <- all(utils::hasName(.data, names(reference))) - if (has_expected_names) TRUE else FALSE - } -} diff --git a/R/imports.R b/R/imports.R index 3ed8744..af27425 100644 --- a/R/imports.R +++ b/R/imports.R @@ -12,6 +12,11 @@ #' @importFrom tibble tibble as.tibble as_tibble NULL +#' @importFrom fgeo.tool assert_is_installed +#' @export +#' @keywords internal +fgeo.tool::assert_is_installed + #' Pipe operator #' #' See \code{magrittr::\link[magrittr]{\%>\%}} for details. diff --git a/R/summary.R b/R/summary.R index d8b5543..d395ff9 100644 --- a/R/summary.R +++ b/R/summary.R @@ -10,6 +10,8 @@ #' @seealso [tt_test()], [base::summary()]. #' #' @examples +#' assert_is_installed("fgeo.x") +#' #' tt_result <- tt_test(fgeo.x::tree6_3species, fgeo.x::habitat) #' #' summary(tt_result) diff --git a/R/tt_test.R b/R/tt_test.R index af37798..8999f84 100644 --- a/R/tt_test.R +++ b/R/tt_test.R @@ -67,6 +67,7 @@ #' #' @examples #' library(fgeo.tool) +#' assert_is_installed("fgeo.x") #' #' # Example data #' tree <- fgeo.x::tree6_3species @@ -406,7 +407,13 @@ rename_to_xy <- function(x) { } check_tt_test <- function(census, habitat, sp, plotdim, gridsize) { - has_stem_names <- !has_table_names(fgeo.x::tree6)(census) + tree_names <- c( + "treeID", "stemID", "tag", "StemTag", "sp", "quadrat", "gx", "gy", + "MeasureID", "CensusID", "dbh", "pom", "hom", "ExactDate", "DFstatus", + "codes", "nostems", "status", "date" + ) + has_stem_names <- !all(names(census) %in% tree_names) + msg <- "Is `census` a tree table (not a stem table)? See `?tt_test()`." if (has_stem_names) warn(msg) diff --git a/docs/news/index.html b/docs/news/index.html index 126c903..e1c1372 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3 + 1.1.1 @@ -124,9 +124,24 @@

Changelog

Source: NEWS.md -
+

-fgeo.analyze 1.0.3 (GitHub release)

+fgeo.analyze 1.1.1 (GitHub release) +
    +
  • fgeo.x no longer is imported but suggested.
  • +
+
+
+

+fgeo.analyze 1.1.0 (GitHub release)

+ +
+
+

+fgeo.analyze 1.0.3 (GitHub and drat release)

  • Released version now uses released versions recursively via @*release.
@@ -158,7 +173,9 @@

Contents