R: Count entries in a factor

fct_count {forcats} | R Documentation

## Count entries in a factor

### Description

Count entries in a factor

### Usage

    fct_count(f, sort = FALSE)

### Arguments

`f` | A factor (or character vector).
`sort` | If `TRUE`, sort the result so that the most common values float to the top.

### Value

A tibble with columns `f` and `n`.

### Examples

    f <- factor(sample(letters)[rpois(1000, 10)])
    table(f)
    fct_count(f)
    fct_count(f, sort = TRUE)

[Package forcats version 0.3.0 Index]