Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 10, 2024
1 parent 81182b8 commit 30f6ba5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CHANGES
variables, can now also be a character vector with quoted variable names,
including a colon to indicate a range of several variables (e.g. `"cyl:gear"`).

* New function `row_count()`, to calculate row-wise sums of specific values.
* New function `row_count()`, to count specific values row-wise.

BUG FIXES

Expand Down
10 changes: 5 additions & 5 deletions R/row_count.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#' @title Row means or sums (optionally with minimum amount of valid values)
#' @title Count specific values row-wise
#' @name row_count
#' @description `row_count()` mimics base R's `rowSums()`, with sums for a
#' specific value indicated by `count`. Hence, it is equivalent to
#' `rowSums(x == count, na.rm = TRUE)`, but offers some more options, including
#' strict comparisons: Comparisons using `==` coerce values to atomic vectors,
#' strict comparisons. Comparisons using `==` coerce values to atomic vectors,
#' thus both `2 == 2` and `"2" == 2` are `TRUE`. In `row_count()`, it is also
#' possible to make "type safe" comparisons using the `exact` argument, where
#' `"2" == 2` is not treated as identical.
#' `"2" == 2` is not true.
#'
#' @param data A data frame with at least two columns, where number of specific
#' values are counted row-wise.
#' @param count The value for which the row sum should be computed. May be a
#' numeric value, a character string (for factors or character vectors), `NA` or
#' `Inf`.
#' @param exact Logical, if `TRUE`, `count` matches only values of same type
#' @param exact Logical. If `TRUE`, `count` matches only values of same type
#' (i.e. when `count = 2`, the value `"2"` is not counted and vice versa).
#' By default, when `exact = FALSE`, `count = 2` also matches `"2"`. See
#' 'Examples'.
Expand All @@ -32,7 +32,7 @@
#' )
#'
#' # count all 2s per row
#' row_count(dat, count = 2)
#' row_count(dat, count = 4)
#' # count all missing values per row
#' row_count(dat, count = NA)
#'
Expand Down
10 changes: 5 additions & 5 deletions man/row_count.Rd

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

0 comments on commit 30f6ba5

Please sign in to comment.