asSimpleVector: Example functions for the Chapter on Debugging

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/debug.R

Description

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

Usage

1
2
3
4
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

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

RBioinf documentation built on Nov. 8, 2020, 11:11 p.m.