Skip to content

Commit

Permalink
Improve docs for fct_in* family
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Feb 28, 2020
1 parent 874315b commit e13df2a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
12 changes: 8 additions & 4 deletions R/reorder.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@ first2 <- function(.x, .y) {



#' Reorder factors levels by first appearance, frequency, or numeric order.
#' Reorder factor levels by first appearance, frequency, or numeric order.
#'
#' This family of functions changes only the order of the levels.
#' * `fct_inorder()`: by the order in which they first appear.
#' * `fct_infreq()`: by number of observations with each level (largest first)
#' * `fct_inseq()`: by numeric value of level.
#'
#' @inheritParams lvls_reorder
#' @param f A factor
Expand All @@ -106,9 +111,8 @@ first2 <- function(.x, .y) {
#' fct_inorder(f)
#' fct_infreq(f)
#'
#' fct_inorder(f, ordered = TRUE)
#'
#' f <- factor(sample(1:10))
#' f <- factor(1:3, levels = c("3", "2", "1"))
#' f
#' fct_inseq(f)
fct_inorder <- function(f, ordered = NA) {
f <- check_factor(f)
Expand Down
14 changes: 9 additions & 5 deletions man/fct_inorder.Rd

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

0 comments on commit e13df2a

Please sign in to comment.