Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
vertesy committed Sep 23, 2024
1 parent abeaebd commit b595b78
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/CodeAndRoll2.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,10 @@ table_decreasing_hybrid <- function(vec, first_elements = FALSE, useNA = "ifany"
if(isFALSE(first_elements)) {
return(tbl_decr)
} else {
stopifnot(all(first_elements %in% names(tbl_decr)))
c(tbl_decr[first_elements], tbl_decr[!names(tbl_decr) %in% first_elements])
if( !all(first_elements %in% names(tbl_decr))) warning("Not all elements are found in the table!", immediate. = T)
first_elements <- intersect(first_elements, names(tbl_decr))
tbl_decr <- c(tbl_decr[first_elements], tbl_decr[!names(tbl_decr) %in% first_elements])
return(tbl_decr)
}
}

Expand Down

0 comments on commit b595b78

Please sign in to comment.