asSimpleVector {RBioinf} | R Documentation

## Example functions for the Chapter on Debugging

### Description

These functions are used to demonstrate some of the debugging facilities in R.

### Usage

    asSimpleVector(x, mode = "logical")
    convertMode(from, to)
    setVNames(x, nm)
    subsetAsCharacter(x, i, j)

### Arguments

`x` | input
`mode` | the mode of `x`
`from` | a parameter
`to` | another parameter
`nm` | names for `x`
`i` | an index
`j` | another index

### Details

A set of functions that can be used to demonstrate debugging principles and practices.

`asSimpleVector` converts the argument `x` to a simple R vector of the given mode preserving names, dimension and dimnames.

`subsetAsCharacter` calculates either a vector or a matrix subset of the argument `x` and returns the subset after converting it to be of mode character. It uses `asSimpleVector` to do the conversion to character and thus also preserves any names, dimension or dimnames in the subset.

`setVNames` sets the names of the given vector `x` to the argument `nm` and then converts `x` to numeric using `asSimpleVector`.

`convertMode` converts its first argument to the mode of the second argument.

### Value

Various values are returned.

### Author(s)

S. DebRoy

### See Also

`browser`

### Examples

      asSimpleVector(list(a = 1, b = 2), "character")

[Package RBioinf version 1.47.0 Index]