median_index {rearrr}R Documentation

Find index of interest for each vector

Description

[Experimental]

Applies function to the indices of each vector in `...`.

These functions were created with create_n_fn().

Usage

median_index(..., negate = FALSE, round_fn = round)

quantile_index(..., prob, type = 7, negate = FALSE, round_fn = round)

Arguments

...

Numeric vectors.

negate

Whether to negate the result. I.e. to multiply it with -1. (Logical)

round_fn

Function for rounding output. Rounding is done prior to negation.

E.g. round, floor, or ceiling.

prob

Probability in [0,1] for quantile().

type

Quantile algorithm to use. See quantile().

Value

numeric vector with one element per supplied vector.

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

Other n functions: create_n_fn()

Examples


# Attach packages
library(rearrr)

# Set seed
set.seed(1)

# Create three vectors
x <- runif(10)
y <- runif(15)
z <- runif(20)

median_index(x, y, z)
quantile_index(x, y, z, prob = 0.2)

# Negate result
median_index(x, y, z, negate = TRUE)


[Package rearrr version 0.3.4 Index]