Skip to content

Add desc argument to fct_infreq()#391

Open
chrislongros wants to merge 1 commit into
tidyverse:mainfrom
chrislongros:feature/365-fct-infreq-desc
Open

Add desc argument to fct_infreq()#391
chrislongros wants to merge 1 commit into
tidyverse:mainfrom
chrislongros:feature/365-fct-infreq-desc

Conversation

@chrislongros

Copy link
Copy Markdown

Closes #365.

Adds a desc argument so you can order levels by ascending frequency with desc = FALSE. Defaults to TRUE so nothing changes for existing code.

f <- factor(c("b", "b", "a", "c", "c", "c"))
fct_infreq(f)              # c, b, a (descending, same as before)
fct_infreq(f, desc = FALSE) # a, b, c (ascending)

Includes docs, an example, and tests. R CMD check passes with 0 errors, 0 warnings, 0 notes.

Lets you order levels by ascending frequency with desc = FALSE.
Defaults to TRUE so existing behaviour is unchanged.

Closes tidyverse#365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Allow Increasing Order in fct_infreq

1 participant