New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add weight argument to fct_infreq #330
Conversation
R/reorder.R
Outdated
@@ -134,10 +134,23 @@ fct_inorder <- function(f, ordered = NA) { | |||
|
|||
#' @export | |||
#' @rdname fct_inorder | |||
fct_infreq <- function(f, ordered = NA) { | |||
#' @param weight Optional vector of numeric values to weight by. | |||
fct_infreq <- function(f, weight = NULL, ordered = NA) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is weight
the right name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fct_lump()
and the other functions in that family use w
FWIW
I don't think there are any other weighted forcats functions to compare with.
R/reorder.R
Outdated
@@ -134,10 +134,23 @@ fct_inorder <- function(f, ordered = NA) { | |||
|
|||
#' @export | |||
#' @rdname fct_inorder | |||
fct_infreq <- function(f, ordered = NA) { | |||
#' @param weight Optional vector of numeric values to weight by. | |||
fct_infreq <- function(f, weight = NULL, ordered = NA) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fct_lump()
and the other functions in that family use w
FWIW
I don't think there are any other weighted forcats functions to compare with.
R/reorder.R
Outdated
fct_infreq <- function(f, ordered = NA) { | ||
#' @param weight Optional vector of numeric values to weight by. | ||
fct_infreq <- function(f, weight = NULL, ordered = NA) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you expect the argument ordering here to matter? Probably not much? i.e. if someone specified ordered
without naming the argument. Seems unlikely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that seems ok
Co-authored-by: Davis Vaughan <davis@rstudio.com>
#Conflicts: # NEWS.md # tests/testthat/test-reorder.R
Fixes #261