View source: R/aided_chatgpt.R
mode.calc | R Documentation |
This function calculates the mode (most frequently occurring value(s)) of a numeric or character vector.
mode.calc(x)
x |
A numeric or character vector for which the mode is to be calculated. |
The mode(s) of the input vector. If multiple values have the same highest frequency, all modes are returned. Returns 'NA' if the input vector is empty.
# Example with a numeric vector
numeric_vector <- c(1, 2, 2, 3, 3, 3, 4, 5)
mode.calc(numeric_vector)
# Example with a character vector
character_vector <- c("apple", "banana", "apple", "orange", "banana", "banana")
mode.calc(character_vector)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.