The “cummin” Function in R

  • Package: Base R (No specific package, it’s a built-in function)

  • Purpose: To compute the cumulative minimum of a numeric vector.

  • General Class: Mathematical Computation

  • Required Argument(s):

    • x: A numeric vector for which the cumulative minimum is to be computed.

  • Notable Optional Arguments:

    • None

  • Example:

  • # Example usage
    my_vector <- c(2, 3, 1, 4, 5)
    cumulative_minimum <- cummin(my_vector)

    print(cumulative_minimum)

  • In this example, cummin is a built-in function in base R, and it is used to calculate the cumulative minimum of a numeric vector. The x argument is the only required argument, and it represents the numeric vector for which the cumulative minimum is calculated. There are no notable optional arguments for this function. The result is a numeric vector where each element represents the cumulative minimum up to that point in the input vector.

Previous
Previous

The “cummax” Function in R

Next
Next

The “cumprod” Function in R