Skip to content

Commit 902efdf

Browse files
calculation functions that use the groups option now warn if groups is used without cols.
relates to #233
1 parent f4d4e41 commit 902efdf

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: metacoder
22
Title: Tools for Parsing, Manipulating, and Graphing Taxonomic Abundance Data
3-
Version: 0.3.1
3+
Version: 0.3.1.9001
44
Authors@R: c(person("Zachary", "Foster", email =
55
"zacharyfoster1989@gmail.com", role = c("aut", "cre")),
66
person("Niklaus", "Grunwald", email =

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# News
22

3+
## Development version
4+
5+
* calculation functions that use the `groups` option now warn if `groups` is used without `cols`.
6+
37
## metacoder 0.3.1
48

59
### Bug fixes

R/calculations--internal.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ get_numeric_cols <- function(obj, data, cols = NULL) {
8383
#' @keywords internal
8484
do_calc_on_num_cols <- function(obj, data, func, cols = NULL, groups = NULL,
8585
other_cols = FALSE, out_names = NULL) {
86+
87+
# Warn if groups is used with no cols specified
88+
if (is.null(cols) && !is.null(groups)) {
89+
message('NOTE: Using the "groups" option without the "cols" option can yeild incorrect results if the column order is different from the group order.\n')
90+
}
91+
8692
# Get input table
8793
input <- get_taxmap_table(obj, data)
8894

0 commit comments

Comments
 (0)