Trusted answers to developer questions

Onyejiaku Theophilus Chidalu

In R, the **pmin()**** function** is used to obtain the parallel minima of two or more given vectors. In simple words, it returns the minimum of the values of the two or more vectors pair-wise.

pmin(..., na.rm = FALSE)

Syntax for the pmin() function in R

This function takes the following parameter values:

: This represents input vector objects. This parameter is required.**...**

: This takes a logical value (**na.rm**`TRUE`

or`FALSE`

) indicating if the missing values should be removed or not. This parameter is optional.

This function returns a vector with the longest of the input vectors representing the pair-wise minima of the input vectors.

# creating vector a <- c(10, 8, 3, 9, 0, 5) b <- c(15, 4, 6, 9, 8, 4) # obtaining the maximum values pairwise pmin(a, b)

Implementing the pmin() function in R

- Line 2 and 3: We create vector objects,
`a`

and`b`

. - Line 6: We obtain the minimum values in the input vector objects pairwise.

RELATED TAGS

r

function

communitycreator

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

RELATED COURSES

View all Courses

Keep Exploring

Related Courses