Skip to content

Commit

Permalink
Add nsti2Freq function.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed Apr 3, 2024
1 parent ec023d9 commit 49e4be8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: taxPPro
Type: Package
Title: Taxonomic and phylogenetic propagation for bugphyzz
Version: 0.99.0
Version: 0.99.1
Authors@R:
c(
person(
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export(getNsti)
export(getSetWithIDs)
export(getSetWithoutIDs)
export(ltp)
export(nsti2Freq)
export(roundDec)
export(scores2Freq)
20 changes: 20 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,23 @@ roundDec <- function(x) {
ceiling(((1 / n) + 1e-06) * 10) / 10
}


#' NSTI to Frequency
#'
#' \code{nsti2Freq} converts nsti values to frequencuy keywords.
#'
#' @param x A numeric vectir of nsti values
#'
#' @return A character vector of frequency keywords.
#' @export
#'
nsti2Freq <- function(x) {
dplyr::case_when(
is.na(x) ~ NA,
x == 0 ~ "always",
x > 0 & x <= 0.05 ~ "usually",
x > 0.05 & x <= 0.15 ~ "sometimes",
x > 0.15 & x <= 0.2 ~ "rarely",
x > 0.2 ~ "never"
)
}
17 changes: 17 additions & 0 deletions man/nsti2Freq.Rd

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

0 comments on commit 49e4be8

Please sign in to comment.