From 9322bb6aabb9a85f065f75ddc97b51ac59b4f724 Mon Sep 17 00:00:00 2001 From: Mauro Lepore Date: Tue, 29 Jan 2019 12:18:05 -0600 Subject: [PATCH] Release 1.1.0 (#69) ### Minor * Rename first argument to meet tidyverse principles ### Patch * Fix r buidignore revdep * Style * Update installation instructions * Update cran comments, description and wordslist --- .Rbuildignore | 2 +- DESCRIPTION | 10 +-- NEWS.md | 8 +- R/abundance.R | 134 +++++++++++++++++----------------- R/byyr.R | 46 ++++++------ R/fgeo_habitat.R | 18 ++--- R/fgeo_topography.R | 39 +++++----- R/tt_test.R | 34 ++++----- README.Rmd | 4 +- README.md | 4 +- cran-comments.md | 12 ++- docs/CODE_OF_CONDUCT.html | 2 +- docs/CONTRIBUTING.html | 2 +- docs/ISSUE_TEMPLATE.html | 2 +- docs/LICENSE.html | 2 +- docs/SUPPORT.html | 2 +- docs/authors.html | 2 +- docs/index.html | 6 +- inst/WORDLIST | 1 + man/abundance.Rd | 8 +- man/fgeo_habitat.Rd | 14 ++-- man/fgeo_topography.Rd | 21 +++--- man/tt_test.Rd | 4 +- tests/testthat/test-tt_test.R | 4 +- 24 files changed, 193 insertions(+), 188 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index a7039c4..247796a 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,4 +1,4 @@ -^revdepcheck$ +^revdep$ ^cran-comments\.md$ ^vignettes$ ^\.buildignore$ diff --git a/DESCRIPTION b/DESCRIPTION index 76dad86..7a843d5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: fgeo.analyze Title: Analyze ForestGEO Data -Version: 1.0.3.9000 +Version: 1.1.0 Authors@R: c(person(given = "Mauro", family = "Lepore", @@ -53,9 +53,9 @@ BugReports: https://github.com/forestgeo/fgeo.analyze/issues Depends: R (>= 3.2) Imports: - fgeo.x, - fgeo.tool, dplyr, + fgeo.tool, + fgeo.x, glue, graphics, grDevices, @@ -77,9 +77,7 @@ Suggests: rmarkdown, spelling, testthat -Remotes: - forestgeo/fgeo.x, - forestgeo/fgeo.tool +Additional_repositories: https://forestgeo.github.io/drat/ Encoding: UTF-8 Language: en-US LazyData: true diff --git a/NEWS.md b/NEWS.md index 271d851..2bda116 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,7 +2,13 @@ * Work in progress. -# fgeo.analyze 1.0.3 (GitHub release) +# fgeo.analyze 1.1.0 (GitHub release) + +* Import fgeo packages via `Additional_repositories` served at + +* First argument of most visible functions now follow tidyverse principles (). + +# fgeo.analyze 1.0.3 (GitHub and drat release) * Released version now uses released versions recursively via @*release. diff --git a/R/abundance.R b/R/abundance.R index d334804..9af82ae 100644 --- a/R/abundance.R +++ b/R/abundance.R @@ -18,55 +18,54 @@ #' Subsetting data is not the job of these functions. Instead see #' [base::subset()], [dplyr::filter()], or `[`. #' -#' @param x A dataframe. [basal_area()] requires a column named `dbh` (case +#' @param data A dataframe. [basal_area()] requires a column named `dbh` (case #' insensitive). #' #' @seealso [dplyr::n()], [dplyr::group_by()]. #' #' @examples #' library(fgeo.tool) -#' +#' #' # abundance() ------------------------------------------------------------- -#' +#' #' abundance(data.frame(1)) -#' +#' #' # One stem per tree #' tree <- tribble( #' ~TreeID, ~StemID, ~DBH, #' "1", "1.1", 11, #' "2", "2.1", 21 #' ) -#' +#' #' abundance(tree) -#' +#' #' # One tree with multiple stems #' stem <- tribble( #' ~TreeID, ~StemID, ~DBH, #' "1", "1.1", 11, #' "1", "1.2", 12 #' ) -#' -#' abundance(stem) #' +#' abundance(stem) #' \dontrun{ #' # Similar but more realistic #' stem <- fgeo.x::download_data("luquillo_stem5_random") -#' +#' #' abundance(stem) -#' +#' #' abundance(pick_main_stem(stem)) #' } -#' +#' #' vft <- tribble( #' ~PlotName, ~CensusID, ~TreeID, ~StemID, ~DBH, #' "p", 1, "1", "1.1", 10, #' "q", 2, "1", "1.1", 10 #' ) -#' +#' #' # * Warns if it detects multiple values of censusid or plotname #' # * Also warns if it detects duplicated values of treeid #' abundance(vft) -#' +#' #' # If trees have buttressess, the data may have multiple stems per treeid or #' # multiple measures per stemid. #' vft2 <- tribble( @@ -76,12 +75,12 @@ #' 1, "2", "2.1", 20, 130, #' 1, "2", "2.2", 30, 130, #' ) -#' +#' #' # You should count only the main stem of each tree #' (main_stem <- pick_main_stem(vft2)) -#' +#' #' abundance(main_stem) -#' +#' #' vft3 <- tribble( #' ~CensusID, ~TreeID, ~StemID, ~DBH, ~HOM, #' 1, "1", "1.1", 20, 130, @@ -89,35 +88,34 @@ #' 2, "1", "1.1", 12, 130, #' 2, "1", "1.2", 22, 130 # Main stem #' ) -#' +#' #' # You can compute by groups #' by_census <- group_by(vft3, CensusID) #' (main_stems_by_census <- pick_main_stem(by_census)) -#' +#' #' abundance(main_stems_by_census) -#' +#' #' # basal_area() ------------------------------------------------------------ -#' +#' #' # Data must have a column named dbh (case insensitive) #' basal_area(data.frame(dbh = 1)) -#' +#' #' # * Warns if it detects multiple values of censusid or plotname #' # * Also warns if it detects duplicated values of stemid #' basal_area(vft) -#' +#' #' # First you may pick the main stemid of each stem #' (main_stemids <- pick_main_stemid(vft2)) -#' +#' #' basal_area(main_stemids) -#' +#' #' # You can compute by groups #' basal_area(by_census) -#' #' \dontrun{ #' measurements_is_installed <- requireNamespace("measurements", quietly = TRUE) #' if (measurements_is_installed) { #' library(measurements) -#' +#' #' # Convert units #' ba <- basal_area(by_census) #' ba$basal_area_he <- conv_unit( @@ -125,26 +123,26 @@ #' from = "mm2", #' to = "hectare" #' ) -#' +#' #' ba #' } #' } -#' +#' #' @family functions for abundance and basal area #' @name abundance NULL with_anycase_group_df <- function(.summary, side_effects) { - function(x) { + function(data) { # Census and ViewFull tables have column names with different case. To # handle both kinds of dataset we lowercase column and group names. - low_nms <- groups_lower(set_names(x, tolower)) + low_nms <- groups_lower(set_names(data, tolower)) # Allow multiple, different side effects for different summaries lapply(side_effects, function(.f) .f(low_nms)) result <- .summary(low_nms) # Restore the original case of names and relevant groups - restore_input_names_output_groups(result, x) + restore_input_names_output_groups(result, data) } } @@ -162,18 +160,21 @@ basal_area <- with_anycase_group_df( list(warn_if_needed_stemid, warn_if_needed_plotname_censusid) ) -abundance_df <- function(x) { - g <- dplyr::group_vars(x) - out <- summarize(x, n = n()) +abundance_df <- function(data) { + g <- dplyr::group_vars(data) + out <- summarize(data, n = n()) dplyr::grouped_df(out, g) } -basal_area_df <- function(x) { - g <- dplyr::group_vars(x) - if (rlang::is_empty(x)) { - x <- tibble(dbh = double(0)) +basal_area_df <- function(data) { + g <- dplyr::group_vars(data) + if (rlang::is_empty(data)) { + data <- tibble(dbh = double(0)) } - out <- summarize(x, basal_area = sum(basal_area_dbl(.data$dbh), na.rm = TRUE)) + out <- summarize( + data, + basal_area = sum(basal_area_dbl(.data$dbh), na.rm = TRUE) + ) dplyr::grouped_df(out, g) } @@ -181,8 +182,8 @@ basal_area_dbl <- function(x) { 1 / 4 * pi * (x)^2 } -groups_lower <- function(x) { - dplyr::grouped_df(x, tolower(dplyr::group_vars(x))) +groups_lower <- function(data) { + dplyr::grouped_df(data, tolower(dplyr::group_vars(data))) } #' Get the correct grouping variables. @@ -192,8 +193,9 @@ groups_lower <- function(x) { #' have the correct grouping variables but with the wrong case. This function #' outputs a sting of the grouping variable in `x` with the case of `y`. #' -#' @param x A dataframe which groups are ok but lowercase. -#' @param y A reference dataframe which gropus are not ok but have correct case. +#' @param data A dataframe which groups are ok but lowercase. +#' @param data_ref A reference dataframe which gropus are not ok but have +#' correct case. #' #' @examples #' out <- dplyr::grouped_df(tibble::tibble(x = 1, y = 1, z = 1), c("x", "y")) @@ -201,61 +203,61 @@ groups_lower <- function(x) { #' ref <- dplyr::grouped_df(rlang::set_names(out, toupper), c("X")) #' group_vars_restore(out, ref) #' @noRd -group_vars_restore <- function(x, y) { +group_vars_restore <- function(data, data_ref) { in_ref <- fgeo.tool::detect_insensitive( - dplyr::group_vars(x), - dplyr::group_vars(y) + dplyr::group_vars(data), + dplyr::group_vars(data_ref) ) fgeo.tool::extract_insensitive( - dplyr::group_vars(x), - dplyr::group_vars(y) + dplyr::group_vars(data), + dplyr::group_vars(data_ref) ) } -restore_input_names_output_groups <- function(out, .data) { - out <- rename_matches(out, .data) - g <- group_vars_restore(out, .data) - dplyr::grouped_df(ungroup(out), g) +restore_input_names_output_groups <- function(data, data_ref) { + data_ <- rename_matches(data, data_ref) + g <- group_vars_restore(data_, data_ref) + dplyr::grouped_df(ungroup(data_), g) } -# Only if data contains specific `name`s. -warn_if_needed_plotname_censusid <- function(.x) { +# Warn only if data contains specific `name`s. +warn_if_needed_plotname_censusid <- function(data) { warn_if_has_var( - .x, + data, name = "censusid", predicate = is_multiple, problem = "Multiple", hint = "Do you need to group by censusid?" ) warn_if_has_var( - .x, + data, name = "plotname", predicate = is_multiple, problem = "Multiple", hint = "Do you need to pick a single plot?" ) - invisible(.x) + invisible(data) } -warn_if_needed_treeid <- function(.x) { +warn_if_needed_treeid <- function(data) { warn_if_has_var( - .x, + data, name = "treeid", predicate = is_duplicated, problem = "Duplicated", hint = "Do you need to pick main stems?" ) - invisible(.x) + invisible(data) } -warn_if_needed_stemid <- function(.x) { +warn_if_needed_stemid <- function(data) { warn_if_has_var( - .x, + data, name = "stemid", predicate = is_duplicated, problem = "Duplicated", hint = "Do you need to pick largest `hom` values?" ) - invisible(.x) + invisible(data) } -warn_if_has_var <- function(.x, name, predicate, problem, hint) { - if (utils::hasName(.x, name)) { +warn_if_has_var <- function(data, name, predicate, problem, hint) { + if (utils::hasName(data, name)) { msg <- glue("`{name}`: {problem} values were detected. {hint}") - fgeo.tool::flag_if_group(.x, name, predicate, warn, msg) + fgeo.tool::flag_if_group(data, name, predicate, warn, msg) } } diff --git a/R/byyr.R b/R/byyr.R index 5b2c546..f5297c3 100644 --- a/R/byyr.R +++ b/R/byyr.R @@ -28,7 +28,7 @@ #' #' @examples #' library(fgeo.tool) -#' +#' #' # Example data #' vft <- tibble( #' PlotName = c("luq", "luq", "luq", "luq", "luq", "luq", "luq", "luq"), @@ -52,13 +52,13 @@ #' Tag = c(1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L), #' HOM = c(130L, 130L, 130L, 130L, 130L, 130L, 130L, 130L) #' ) -#' +#' #' vft -#' +#' #' abundance_byyr(vft, DBH >= 10, DBH < 20) -#' +#' #' abundance_byyr(vft, DBH >= 10) -#' +#' #' basal <- basal_area_byyr(vft, DBH >= 10) #' basal #' \dontrun{ @@ -72,7 +72,7 @@ #' ~ measurements::conv_unit(.x, from = "mm2", to = "hectare") #' ) #' basal_he -#' +#' #' # Standardize #' number_of_hectares <- 50 #' basal_he %>% @@ -148,14 +148,14 @@ pick_byyr <- function(vft, ...) { dplyr::filter(vft, !!!dots) } -add_years <- function(x) { - drop_if_missing_dates(x) %>% +add_years <- function(data) { + drop_if_missing_dates(data) %>% mean_years() %>% fgeo.tool::drop_if_na("year") } -mean_years <- function(vft) { - years <- vft %>% +mean_years <- function(data) { + years <- data %>% set_names(tolower) %>% group_by(.data$plotcensusnumber) %>% summarize( @@ -164,28 +164,28 @@ mean_years <- function(vft) { unique() %>% arrange(.data$plotcensusnumber) %>% ungroup() %>% - rename_matches(vft) + rename_matches(data) - dplyr::left_join(vft, years, by = "plotcensusnumber") %>% + dplyr::left_join(data, years, by = "plotcensusnumber") %>% mutate(species = paste(.data$genus, .data$speciesname)) %>% arrange(.data$year) } -drop_if_missing_dates <- function(x) { - missing_dates <- is.na(insensitive(x)$exactdate) +drop_if_missing_dates <- function(data) { + missing_dates <- is.na(insensitive(data)$exactdate) if (any(missing_dates)) { warn("Detected and ignoring missing dates.") } - x <- x[!missing_dates, , drop = FALSE] - invisible(x) + data <- data[!missing_dates, , drop = FALSE] + invisible(data) } -tidy_byyr_names <- function(x) { - x <- rlang::set_names(x, tolower) +tidy_byyr_names <- function(data) { + data_ <- rlang::set_names(data, tolower) spp_family <- c("species", "family") - yr_nms <- setdiff(names(x), spp_family) - names(x) <- c(spp_family, glue("yr_{yr_nms}")) - x + yr_nms <- setdiff(names(data_), spp_family) + names(data_) <- c(spp_family, glue("yr_{yr_nms}")) + data_ } #' Inform, warn or abort if not all expresisons refer to a given variable. @@ -197,8 +197,8 @@ tidy_byyr_names <- function(x) { #' #' @noRd flag_if_not_expression_of_var <- function(dots, .flag, .var) { - .dots <- rlang::expr_deparse(dots) - if (!any(grepl(.var, .dots))) { + dots_ <- rlang::expr_deparse(dots) + if (!any(grepl(.var, dots_))) { flag_is_abort <- identical(.flag, rlang::abort) request <- ifelse(flag_is_abort, "must", "should") msg <- glue("All expressions passed to `...` {request} refer to `{.var}`.") diff --git a/R/fgeo_habitat.R b/R/fgeo_habitat.R index 57f5cae..f2a83b6 100644 --- a/R/fgeo_habitat.R +++ b/R/fgeo_habitat.R @@ -26,7 +26,7 @@ #' elevation_ls, #' gridsize = 20, n = 4 #' ) -#' +#' #' # Or #' elevation_df <- fgeo.x::elevation$col #' habitats <- fgeo_habitat( @@ -34,32 +34,32 @@ #' gridsize = 20, n = 4, #' xdim = 320, ydim = 500 #' ) -#' +#' #' str(habitats) #' \dontrun{ #' fgeo_plot_is_installed <- requireNamespace("fgeo.plot", quietly = TRUE) #' if (fgeo_plot_is_installed) { #' library(fgeo.plot) -#' +#' #' autoplot(habitats) #' } #' } -#' +#' #' # Habitat data is useful for calculating species-habitat associations #' census <- fgeo.x::tree6_3species -#' +#' #' as_tibble( #' tt_test(census, habitats) #' ) #' @family habitat functions #' @family functions to construct fgeo classes #' @export -fgeo_habitat <- function(elevation, gridsize, n, ...) { - out <- add_cluster(fgeo_topography(elevation, gridsize, ...), n) +fgeo_habitat <- function(elev, gridsize, n, ...) { + out <- add_cluster(fgeo_topography(elev, gridsize, ...), n) names(out) <- sub("cluster", "habitats", names(out)) new_fgeo_habitat(out[c("gx", "gy", "habitats")]) } -new_fgeo_habitat <- function(x) { - structure(x, class = c("fgeo_habitat", class(x))) +new_fgeo_habitat <- function(data) { + structure(data, class = c("fgeo_habitat", class(data))) } diff --git a/R/fgeo_topography.R b/R/fgeo_topography.R index dd94a72..af8648d 100644 --- a/R/fgeo_topography.R +++ b/R/fgeo_topography.R @@ -2,15 +2,10 @@ #' #' @inherit fgeo_habitat details #' -#' @param elevation One of these: -#' * A dataframe containing elevation data, with columns `gx` and `gy` or `x` -#' and `y` (e.g. `fgeo.x::elevation$col`). -#' * A ForestGEO-like elevation list with elements -#' `xdim` and `ydim` giving plot dimensions, and element `col` containing a -#' dataframe as described in the previous item (e.g. `fgeo.x::elevation`). +#' @inheritParams fgeo.tool::fgeo_elevation #' @param gridsize Number giving the size of each quadrat for which a habitat #' is calculated. Commonly, `gridsize = 20`. -#' @param xdim,ydim (Required if `elevation` is a dataframe) `x` and `y` +#' @param xdim,ydim (Required if `elev` is a dataframe) `x` and `y` #' dimensions of the plot. #' @param edgecorrect Correct convexity in edge quadrats? #' @param ... Other arguments passed to methods. @@ -25,24 +20,24 @@ #' @examples #' elev_list <- fgeo.x::elevation #' fgeo_topography(elev_list, gridsize = 20) -#' +#' #' elev_df <- elev_list$col #' fgeo_topography(elev_df, gridsize = 20, xdim = 320, ydim = 500) #' @family habitat functions #' @family functions to construct fgeo classes #' @export -fgeo_topography <- function(elevation, ...) { +fgeo_topography <- function(elev, ...) { UseMethod("fgeo_topography") } #' @export -fgeo_topography.default <- function(elevation, gridsize, ...) { - abort_bad_class(elevation) +fgeo_topography.default <- function(elev, gridsize, ...) { + abort_bad_class(elev) } #' @rdname fgeo_topography #' @export -fgeo_topography.data.frame <- function(elevation, +fgeo_topography.data.frame <- function(elev, gridsize, xdim = NULL, ydim = NULL, @@ -51,24 +46,24 @@ fgeo_topography.data.frame <- function(elevation, force(gridsize) abort_if_xdim_ydim_is_null(xdim, ydim) - elevation_ls <- list(col = elevation, xdim = xdim, ydim = ydim) - fgeo_topography.list(elevation = elevation_ls, gridsize, edgecorrect) + elevation_ls <- list(col = elev, xdim = xdim, ydim = ydim) + fgeo_topography.list(elev = elevation_ls, gridsize, edgecorrect) } #' @rdname fgeo_topography #' @export -fgeo_topography.list <- function(elevation, +fgeo_topography.list <- function(elev, gridsize, edgecorrect = TRUE, ...) { force(gridsize) - plotdim <- c(elevation$xdim, elevation$ydim) + plotdim <- c(elev$xdim, elev$ydim) # Match names-requirements of allquadratslopes() - names(elevation$col) <- sub("gx", "x", names(elevation$col)) - names(elevation$col) <- sub("gy", "y", names(elevation$col)) + names(elev$col) <- sub("gx", "x", names(elev$col)) + names(elev$col) <- sub("gy", "y", names(elev$col)) topo <- suppressMessages( - allquadratslopes(elevation, gridsize, plotdim, edgecorrect) + allquadratslopes(elev, gridsize, plotdim, edgecorrect) ) quad_idx <- as.integer(rownames(topo)) @@ -77,8 +72,8 @@ fgeo_topography.list <- function(elevation, new_fgeo_topography(out) } -new_fgeo_topography <- function(x) { - structure(x, class = c("fgeo_topography", class(x))) +new_fgeo_topography <- function(data) { + structure(data, class = c("fgeo_topography", class(data))) } abort_if_xdim_ydim_is_null <- function(xdim, ydim) { @@ -121,7 +116,7 @@ abort_if_xdim_ydim_is_null <- function(xdim, ydim) { #' @noRd allquadratslopes <- function(elev, gridsize, plotdim, edgecorrect = TRUE) { if (!"col" %in% names(elev)) { - warning("Input to elev must be a list with one element named 'col'.") + warn("Input to elev must be a list with one element named 'col'.") } rw <- cl <- 0 on.exit(message(rw, " ", cl, "\n")) diff --git a/R/tt_test.R b/R/tt_test.R index 6224781..af37798 100644 --- a/R/tt_test.R +++ b/R/tt_test.R @@ -14,7 +14,7 @@ #' abundant species. In a 50-ha plot, a minimum abundance of 50 trees/species #' has been used. #' -#' @param census A dataframe; a ForestGEO _tree_ table (see details). +#' @param tree A dataframe; a ForestGEO _tree_ table (see details). #' @param sp Character sting giving any number of species-names. #' @param habitat Object giving the habitat designation for each #' plot partition defined by `gridsize`. See [`fgeo_habitat()`]. @@ -67,47 +67,47 @@ #' #' @examples #' library(fgeo.tool) -#' +#' #' # Example data #' tree <- fgeo.x::tree6_3species #' elevation <- fgeo.x::elevation -#' +#' #' # Pick alive trees, of 10 mm or more #' census <- filter(tree, status == "A", dbh >= 10) -#' +#' #' # Pick sufficiently abundant species #' pick <- filter(dplyr::add_count(census, sp), n > 50) -#' +#' #' # Use your habitat data or create it from elevation data #' habitat <- fgeo_habitat(elevation, gridsize = 20, n = 4) -#' +#' #' # Defaults to using all species #' as_tibble( #' tt_test(census, habitat) #' ) -#' +#' #' Reduce(rbind, tt_test(census, habitat)) -#' +#' #' some_species <- c("CASARB", "PREMON") #' result <- tt_test(census, habitat, sp = some_species) #' result -#' +#' #' as_tibble(result) -#' +#' #' summary(result) #' @family habitat functions #' @export -tt_test <- function(census, +tt_test <- function(tree, habitat, sp = NULL, plotdim = NULL, gridsize = NULL) { - stopifnot(is.data.frame(census)) + stopifnot(is.data.frame(tree)) - n_row <- nrow(dplyr::filter_all(census, dplyr::all_vars(is.na(.)))) + n_row <- nrow(dplyr::filter_all(tree, dplyr::all_vars(is.na(.)))) if (n_row > 0) { warn(glue("Dropping {n_row} row(s) full of missing values")) - census <- dplyr::filter_all(census, dplyr::any_vars(!is.na(.))) + tree <- dplyr::filter_all(tree, dplyr::any_vars(!is.na(.))) } stopifnot(is.data.frame(habitat)) @@ -122,11 +122,11 @@ tt_test <- function(census, gridsize <- gridsize %||% fgeo.tool::extract_gridsize(habitat) inform_gridsize_plotdim(gridsize, plotdim) - sp <- sp %||% unique(census$sp)[!is.na(unique(census$sp))] + sp <- sp %||% unique(tree$sp)[!is.na(unique(tree$sp))] habitat <- sanitize_habitat_names_if_necessary(habitat) - check_tt_test(census, habitat, sp, plotdim, gridsize) + check_tt_test(tree, habitat, sp, plotdim, gridsize) - abundance <- abund_index(census, plotdim, gridsize) + abundance <- abund_index(tree, plotdim, gridsize) result <- lapply( X = sp, FUN = torusonesp.all, diff --git a/README.Rmd b/README.Rmd index 5c88db3..fc3d7fc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -27,8 +27,8 @@ __fgeo.analyze__ provides functions to analyze [ForestGEO](http://www.forestgeo. Install the latest stable version of **fgeo.analyze** with: ```R -# install.packages("devtools") -devtools::install_github("forestgeo/fgeo.analyze@*release") +these_repos <- c(getOption("repos"), "https://forestgeo.github.io/drat") +install.packages("fgeo.analyze", repos = these_repos) ``` Install the development version of **fgeo.analyze** with: diff --git a/README.md b/README.md index 4d08337..6c739e5 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ status](https://www.r-pkg.org/badges/version/fgeo.analyze)](https://cran.r-proje Install the latest stable version of **fgeo.analyze** with: ``` r -# install.packages("devtools") -devtools::install_github("forestgeo/fgeo.analyze@*release") +these_repos <- c(getOption("repos"), "https://forestgeo.github.io/drat") +install.packages("fgeo.analyze", repos = these_repos) ``` Install the development version of **fgeo.analyze** with: diff --git a/cran-comments.md b/cran-comments.md index b8a1088..c73e8ce 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -6,13 +6,19 @@ ## R CMD check results +'fgeo.analyze' version '1.1.0' + WARNING New submission -Unknown, possibly mis-spelled, fields in DESCRIPTION: - 'Remotes' Strong dependencies not in mainstream repositories: fgeo.tool, fgeo.x +Availability using Additional_repositories specification: + fgeo.tool yes https://forestgeo.github.io/drat/ + fgeo.x yes https://forestgeo.github.io/drat/ ## Downstream dependencies -There are currently no downstream dependencies on CRAN for this package. +I checked 1 reverse dependencies (0 from CRAN + 1 from ; summary at ): + + * I saw 0 new problems + * I failed to check 0 packages diff --git a/docs/CODE_OF_CONDUCT.html b/docs/CODE_OF_CONDUCT.html index 542bc0a..58638bd 100644 --- a/docs/CODE_OF_CONDUCT.html +++ b/docs/CODE_OF_CONDUCT.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/CONTRIBUTING.html b/docs/CONTRIBUTING.html index 049e21a..293f4d8 100644 --- a/docs/CONTRIBUTING.html +++ b/docs/CONTRIBUTING.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/ISSUE_TEMPLATE.html b/docs/ISSUE_TEMPLATE.html index ccba654..2fe6aa1 100644 --- a/docs/ISSUE_TEMPLATE.html +++ b/docs/ISSUE_TEMPLATE.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 79eae22..321a528 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/SUPPORT.html b/docs/SUPPORT.html index ac442a8..a709716 100644 --- a/docs/SUPPORT.html +++ b/docs/SUPPORT.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/authors.html b/docs/authors.html index 30dda52..47f3a6f 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -60,7 +60,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 diff --git a/docs/index.html b/docs/index.html index f79842e..97f8ea7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -31,7 +31,7 @@ fgeo.analyze - 1.0.3.9000 + 1.1.0 @@ -103,8 +103,8 @@

Installation

Install the latest stable version of fgeo.analyze with:

-
# install.packages("devtools")
-devtools::install_github("forestgeo/fgeo.analyze@*release")
+
these_repos <- c(getOption("repos"), "https://forestgeo.github.io/drat")
+install.packages("fgeo.analyze", repos = these_repos)

Install the development version of fgeo.analyze with:

diff --git a/inst/WORDLIST b/inst/WORDLIST index 812c551..041ec83 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -33,6 +33,7 @@ substract Tarak tbl tibble +tidyverse treeid tt TT diff --git a/man/abundance.Rd b/man/abundance.Rd index dc6c9a5..36b6eac 100644 --- a/man/abundance.Rd +++ b/man/abundance.Rd @@ -5,12 +5,12 @@ \alias{basal_area} \title{Abundance and basal area, optionally by groups.} \usage{ -abundance(x) +abundance(data) -basal_area(x) +basal_area(data) } \arguments{ -\item{x}{A dataframe. \code{\link[=basal_area]{basal_area()}} requires a column named \code{dbh} (case +\item{data}{A dataframe. \code{\link[=basal_area]{basal_area()}} requires a column named \code{dbh} (case insensitive).} } \description{ @@ -57,7 +57,6 @@ stem <- tribble( ) abundance(stem) - \dontrun{ # Similar but more realistic stem <- fgeo.x::download_data("luquillo_stem5_random") @@ -122,7 +121,6 @@ basal_area(main_stemids) # You can compute by groups basal_area(by_census) - \dontrun{ measurements_is_installed <- requireNamespace("measurements", quietly = TRUE) if (measurements_is_installed) { diff --git a/man/fgeo_habitat.Rd b/man/fgeo_habitat.Rd index 2f7b6ae..54774ed 100644 --- a/man/fgeo_habitat.Rd +++ b/man/fgeo_habitat.Rd @@ -4,16 +4,16 @@ \alias{fgeo_habitat} \title{Create habitat data from measures of topography.} \usage{ -fgeo_habitat(elevation, gridsize, n, ...) +fgeo_habitat(elev, gridsize, n, ...) } \arguments{ -\item{elevation}{One of these: +\item{elev}{One of these: \itemize{ -\item A dataframe containing elevation data, with columns \code{gx} and \code{gy} or \code{x} -and \code{y} (e.g. \code{fgeo.x::elevation$col}). -\item A ForestGEO-like elevation list with elements -\code{xdim} and \code{ydim} giving plot dimensions, and element \code{col} containing a -dataframe as described in the previous item (e.g. \code{fgeo.x::elevation}). +\item A dataframe containing elevation data, with columns \code{gx}, \code{gy}, and +\code{elev}, or \code{x}, \code{y}, and \code{elev} (e.g. \code{fgeo.x::elevation$col}). +\item A ForestGEO-like elevation list with elements \code{xdim} and \code{ydim} giving +plot dimensions, and element \code{col} containing a dataframe as described in +the previous item (e.g. \code{fgeo.x::elevation}). }} \item{gridsize}{Number giving the size of each quadrat for which a habitat diff --git a/man/fgeo_topography.Rd b/man/fgeo_topography.Rd index 9658ab6..49e39f4 100644 --- a/man/fgeo_topography.Rd +++ b/man/fgeo_topography.Rd @@ -6,22 +6,21 @@ \alias{fgeo_topography.list} \title{Create topography data: convexity, slope, and mean elevation.} \usage{ -fgeo_topography(elevation, ...) +fgeo_topography(elev, ...) -\method{fgeo_topography}{data.frame}(elevation, gridsize, xdim = NULL, +\method{fgeo_topography}{data.frame}(elev, gridsize, xdim = NULL, ydim = NULL, edgecorrect = TRUE, ...) -\method{fgeo_topography}{list}(elevation, gridsize, edgecorrect = TRUE, - ...) +\method{fgeo_topography}{list}(elev, gridsize, edgecorrect = TRUE, ...) } \arguments{ -\item{elevation}{One of these: +\item{elev}{One of these: \itemize{ -\item A dataframe containing elevation data, with columns \code{gx} and \code{gy} or \code{x} -and \code{y} (e.g. \code{fgeo.x::elevation$col}). -\item A ForestGEO-like elevation list with elements -\code{xdim} and \code{ydim} giving plot dimensions, and element \code{col} containing a -dataframe as described in the previous item (e.g. \code{fgeo.x::elevation}). +\item A dataframe containing elevation data, with columns \code{gx}, \code{gy}, and +\code{elev}, or \code{x}, \code{y}, and \code{elev} (e.g. \code{fgeo.x::elevation$col}). +\item A ForestGEO-like elevation list with elements \code{xdim} and \code{ydim} giving +plot dimensions, and element \code{col} containing a dataframe as described in +the previous item (e.g. \code{fgeo.x::elevation}). }} \item{...}{Other arguments passed to methods.} @@ -29,7 +28,7 @@ dataframe as described in the previous item (e.g. \code{fgeo.x::elevation}). \item{gridsize}{Number giving the size of each quadrat for which a habitat is calculated. Commonly, \code{gridsize = 20}.} -\item{xdim, ydim}{(Required if \code{elevation} is a dataframe) \code{x} and \code{y} +\item{xdim, ydim}{(Required if \code{elev} is a dataframe) \code{x} and \code{y} dimensions of the plot.} \item{edgecorrect}{Correct convexity in edge quadrats?} diff --git a/man/tt_test.Rd b/man/tt_test.Rd index 747630d..d9cbe8e 100644 --- a/man/tt_test.Rd +++ b/man/tt_test.Rd @@ -4,10 +4,10 @@ \alias{tt_test} \title{Torus Translation Test to determine habitat associations of tree species.} \usage{ -tt_test(census, habitat, sp = NULL, plotdim = NULL, gridsize = NULL) +tt_test(tree, habitat, sp = NULL, plotdim = NULL, gridsize = NULL) } \arguments{ -\item{census}{A dataframe; a ForestGEO \emph{tree} table (see details).} +\item{tree}{A dataframe; a ForestGEO \emph{tree} table (see details).} \item{habitat}{Object giving the habitat designation for each plot partition defined by \code{gridsize}. See \code{\link[=fgeo_habitat]{fgeo_habitat()}}.} diff --git a/tests/testthat/test-tt_test.R b/tests/testthat/test-tt_test.R index 8d4164e..8304a97 100644 --- a/tests/testthat/test-tt_test.R +++ b/tests/testthat/test-tt_test.R @@ -70,8 +70,8 @@ test_that("species may be factor or character", { test_that("tt_test fails gracefully with bad input", { expect_error( - tt_test(census = 1, c("SLOBER", "PREMON"), habitat = hab_luq), - "data.frame.*census.*is not TRUE" + tt_test(1, c("SLOBER", "PREMON"), habitat = hab_luq), + "data.frame.*is not TRUE" ) expect_error(