Learn R Programming

cointReg (version 0.2.0)

checkObject: Variable check for single objects.

Description

Checking the variable and convert it for internal use, if necessary. (Also used by the cointmonitoR package.)

Usage

checkObject(obj, obj.name, ..., out = "return", .env)

Arguments

obj
[any] Variable or value to check and convert.
obj.name
[character(1)] Name of the object to check. If missing, the name of obj has to be one of the possible names (see details).
...
[any] An alternative to the use of the obj and obj.name arguments is to directly give the name and the variable to be checked via name = variable arguments (see examples). In the case of more than one ... argument, checkVars will be called internally.
out
[character] Whether to "return" or to "assign" the checked (and converted) object. Also possible: c("return", "assign").
.env
[environment] Environment to which to assign the converted obj (usually the same on that contains obj, if it's a variable). Required, if argument out contains "assign".

Value

The checked and converted argument is assigned to the given environment (.env) and/or returned (depending on the argument out).

Details

Possible values of obj.name to check:
"y", "x.stat":
Of type numeric, matrix or data.frame. Only the first row/column will be used. Converted to object: column matrix

"y.fm", "x.coint", "deter":
Of type numeric, matrix or data.frame. Converted to object: column matrix

"m":
Of type numeric(1), has to be greater than 0.

"model":
One of c("FM", "D", "IM").

"signif.level":
Of type numeric(1), has to be in the interval [0.01, 0.1].

"trend", "return.stats", "return.input", "demeaning", "t.test":
Converted to object: logical(1).

"kernel":
One of c("ba", "bo", "da", "pa", "qs", "th", "tr").

"bandwidth":
One of c("and", "nw").

"selector":
One or both c(1, 2).

See Also

Other check: checkDoptions, checkVars

Examples

Run this code
x = matrix(1:20, nrow = 2)
x2 = checkObject(x, "x.coint")
x2

env = environment()
y = 1:10
checkObject(y, out = "assign", .env = env)
y

# example for the use of the ... argument:
det = rbind(1, 1:10)
x3 = sin(10:20)
det2 = checkObject(deter = det)
det2
(checkObject(deter = det, x.stat = x3))

Run the code above in your browser using DataLab