ezMultiplicated: Which values occur at least 'n' times?

View source: R/util.R

ezMultiplicatedR Documentation

Which values occur at least n times?

Description

Keeps multiplicated values by setting them to TRUE.

Usage

ezMultiplicated(x, n = 2, mode = "keepFirst")

Arguments

x

a vector, matrix or list.

n

a positive integer specifying how many times a value needs to occur to return true.

mode

specifies how to keep multiplicated values. Possible modes:

  • "keepFirst" keeps values that occur n times in the original order.

  • "keepLast" keeps values that occur n times in a reversed order.

  • "random" keeps values that occur n times in a randomized order.

  • "all" keeps all values that occur n times independent of the order.

Value

Returns a logical indicating which values are multiplicated according to the specified mode and n.

Author(s)

Rehrauer, Hubert

Schmid, Peter

Examples

v1 = c(1,2,3,4,5,4,3,2,3,4,5,6,7,8,7)
ezMultiplicated(v1)
ezMultiplicated(v1,3)
ezMultiplicated(v1,2,"all")

uzh/ezRun documentation built on April 14, 2024, 5:09 a.m.