# isrep: Is Repeated in a Vector In prob: Elementary Probability on Finite Sample Spaces

## Description

Tests for a certain number of repetitions of `vals` in a given vector `x`.

## Usage

 ```1 2 3 4 5 6 7``` ```isrep(x, ...) ## Default S3 method: isrep(x, vals = unique(x), nrep = 2, ...) ## S3 method for class 'data.frame' isrep(x, ...) ```

## Arguments

 `x` an object with potential repeated values. `vals` values that may be repeated. `nrep` exact number of repeats desired, defaults to pairs. `...` further arguments to be passed to or from other methods.

## Details

This is a generic function, with methods supplied for data frames and vectors. The default behavior tests for existence of pairs of elements of `x`. One can test existence of triples, etc., by changing the `nrep` argument. If there are specific values for which one is looking for repeats, these can be specified with the `vals` argument. Note that the function only checks for exactly `nrep` instances, so two pairs of a specific element would be counted as 0 pairs and 1 quadruple. See the examples.

The data frame method uses `apply` to apply `isrep.default` to each row of the data frame.

Logical.

## Author(s)

G. Jay Kerns gkerns@ysu.edu.

`countrep`

## Examples

 ```1 2 3 4``` ```x <- c(3,3,2,2,3,3,4,4) isrep(x) # one pair each of 2s and 4s isrep(x, nrep = 4) isrep(x, vals = 4) # one pair of 4s ```

### Example output

```Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

combn

Attaching package: 'prob'

The following objects are masked from 'package:base':

intersect, setdiff, union

 TRUE
 TRUE
 TRUE
```

prob documentation built on May 2, 2019, 12:20 p.m.