Nothing
# Standalone file: do not edit by hand
# Source: <https://github.com/ddsjoberg/standalone/blob/main/R/standalone-forcats.R>
# ----------------------------------------------------------------------
#
# DO NOT MODIFY THIS FILE. INSTEAD MODIFY THE VERSION IN https://github.com/ddsjoberg/standalone/tree/main/R
# ---
# file: standalone-forcats.R
# last-updated: 2024-01-24
# license: https://unlicense.org
# imports:
# ---
#
# This file provides a minimal shim to provide a forcats-like API on top of
# base R functions. They are not drop-in replacements but allow a similar style
# of programming.
#
# ## Changelog
#
# nocov start
# styler: off
fct_infreq <- function(f, ordered = NA) {
# reorder by frequency
factor(
f,
levels = table(f) |> sort(decreasing = TRUE) |> names(),
ordered = ifelse(is.na(ordered), is.ordered(f), ordered)
)
}
fct_inorder <- function(f, ordered = NA) {
factor(
f,
levels = stats::na.omit(unique(f)) |> union(levels(f)),
ordered = ifelse(is.na(ordered), is.ordered(f), ordered)
)
}
# nocov end
# styler: on
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.