n_count: The 'n_count' function calculates the number of occurrences...

View source: R/utils.R

n_countR Documentation

The 'n_count' function calculates the number of occurrences of a specific value 'n' in a numeric vector 'x'.

Description

The 'n_count' function calculates the number of occurrences of a specific value 'n' in a numeric vector 'x'.

Usage

n_count(x, n)

Arguments

x

Numeric vector in which to count occurrences.

n

Numeric value to count occurrences of.

Value

An integer representing the count of occurrences of 'n' in 'x'.

Examples

x <- c(1, 2, 3, 2, 4, 2)
n_count(x, 2)  # Returns 3


mbannert/dropR documentation built on March 28, 2024, 2:12 p.m.