Skip to content

Commit

Permalink
Merge pull request #28 from SchlossLab/isnondesc
Browse files Browse the repository at this point in the history
Write is_nondesc() to check whether variables are in non-descending order
  • Loading branch information
sklucas authored Nov 19, 2021
2 parents 6730c0d + f53ec1d commit e0a1270
Show file tree
Hide file tree
Showing 33 changed files with 284 additions and 2,811 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
-m '📄 Render README.Rmd' || echo "No changes to commit"
- name: Docs
run: |
Rscript -e "devtools::build_site()"
Rscript -e "pkgdown::build_reference; devtools::build_site()"
git add docs
git commit \
--author="github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" \
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

export("%>%")
export(.data)
export(close_enough)
export(format_number)
export(inline_hook)
export(is_nearly_whole)
export(is_nondesc)
export(load_deps)
export(paste_oxford_list)
export(read_dist)
Expand Down
14 changes: 9 additions & 5 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

- Added a `NEWS.md` file to track changes to the package.
- Major new functions:
- `read_dist()`
- `read_tax()`
- `inline_hook()`
- `paste_oxford_list()`
- `format_number()`
- `read_dist()` (#10, @NLesniak)
- `read_tax()` (#22, @NLesniak)
- `set_knitr_opts()` (#21, @pschloss, @kelly-sovacool)
- `inline_hook()` (#21, @pschloss, @kelly-sovacool)
- `paste_oxford_list()` (#21, @pschloss, @kelly-sovacool)
- `format_number()` (#24, @pschloss, @kelly-sovacool)
- `is_nearly_whole()` (#24, @pschloss, @kelly-sovacool)
- `close_enough()` (#26, @kelly-sovacool)
- `is_nondesc()` (#28, @kelly-sovacool)
- New vignettes:
- `introduction`
25 changes: 25 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ close_enough <- function(x, y, tol = 10^-3) {
all(dplyr::near(x, y, tol = tol))
}

#' Check whether all elements given are sorted in non-descending order
#'
#' @param ... anything!
#'
#' @return `TRUE` if the elements are sorted in non-descending order, otherwise `FALSE`
#' @export
#' @author Kelly Sovacool \email{sovacool@@umich.edu}
#'
#' @examples
#'
#' is_nondesc(1, 2, 3)
#' is_nondesc(c(1, 2), 3)
#' is_nondesc(6, 4, 1)
#' is_nondesc("a", "b", "c")
#' is_nondesc(c("z", "y"))
is_nondesc <- function(...) {
things <- c(...)
if (length(things) < 1) {
warning("Zero elements were given to `is_nondesc()`")
}
first <- things[1]
last <- things[length(things)]
!is.unsorted(things) & first <= last
}

#' Install & load packages
#' @param ... package names to install & load
#' @export
Expand Down
4 changes: 2 additions & 2 deletions docs/CONTRIBUTING.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ pkgdown: 1.6.1
pkgdown_sha: ~
articles:
introduction: introduction.html
last_built: 2021-10-25T18:09Z
last_built: 2021-11-08T17:31Z

170 changes: 0 additions & 170 deletions docs/reference/DistCalc-package.html

This file was deleted.

Loading

0 comments on commit e0a1270

Please sign in to comment.