Skip to content

Commit

Permalink
Fix names of 'set' column based on given 'sample_sets'
Browse files Browse the repository at this point in the history
  • Loading branch information
bodkan committed Nov 9, 2022
1 parent f06205c commit 2a6781a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions R/tree-sequences.R
Original file line number Diff line number Diff line change
Expand Up @@ -1797,11 +1797,12 @@ oneway_stat <- function(ts, stat, sample_sets, mode, windows, span_normalise = N

if (!is.list(values)) values <- as.numeric(values) # convert 1D arrays to simple vectors

if (all(sapply(sample_sets, length) == 1))
set_names <- unlist(sample_sets)
else if (is.null(names(sample_sets)))
set_names <- paste0("set_", seq_len(n_sets))
else
if (is.null(names(sample_sets)) || any(names(sample_sets) == "")) {
if (all(sapply(sample_sets, length) == 1))
set_names <- unlist(sample_sets)
else
set_names <- paste0("set_", seq_len(n_sets))
} else
set_names <- names(sample_sets)

result <- dplyr::tibble(set = set_names)
Expand Down

0 comments on commit 2a6781a

Please sign in to comment.