R: Construct a logical vector with 'TRUE' in specified...

unwhich {statnet.common} | R Documentation

## Construct a logical vector with `TRUE` in specified positions.

### Description

This function is basically an inverse of `which`.

### Usage

    unwhich(which, n)

### Arguments

`which` | a numeric vector of indices to set to `TRUE`.
`n` | total length of the output vector.

### Value

A logical vector of length `n` whose elements listed in `which` are set to `TRUE`, and whose other elements are set to `FALSE`.

### Examples

    x <- as.logical(rbinom(10,1,0.5))
    stopifnot(all(x == unwhich(which(x), 10)))

[Package statnet.common version 4.4.1 Index]