NVAR: Number of Variables

Description Usage Arguments Value Examples

View source: R/econModelBase.R

Description

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
NCOL wrongly returns value one(1)
on non-data.frame 2nd dimension objects
with a 2nd dimension size of zero(0).

This function NVAR correctly determines the number
of variables (NVAR) in an object.

R S3 class implementations exist for classes: xts

Contributions are welcome.

Usage

1
2
3
4
5
6
7
NVAR(x)

## Default S3 method:
NVAR(x)

## S3 method for class 'xts'
NVAR(x)

Arguments

x

object

Value

integer number of variables

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 

# examples

NVAR(NULL)
[1] 0

NVAR(numeric())
[1] 0

NVAR(integer())
[1] 0

NVAR(character())
[1] 0

## End(Not run)
## Not run: 

# xts example

library(xts)
NVAR(xts(, as.Date("1970-01-01")))
[1] 0

## End(Not run)

AndreMikulec/econModel documentation built on June 30, 2021, 9:48 a.m.