is_one_dim: Test if an object has one-dimension

Description Usage Arguments Value Examples

Description

Returns TRUE if an object is a vector or a one-dimensional matrix, FALSE otherwise

Usage

1

Arguments

x

an R object

Value

whether x is one-dimensional

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# vector
is_one_dim(1:5)  # TRUE

# factor
is_one_dim(iris$Species)  # TRUE

# one row matrix
is_one_dim(matrix(1:5, 1, 5))  # TRUE

# one column matrix
is_one_dim(matrix(1:5, 5, 1))  # TRUE

# general matrix (nrow>1, ncol>1)
is_one_dim(matrix(1:9, 3, 3))  # FALSE

# general data frame
is_one_dim(iris)  # FALSE

tester documentation built on May 2, 2019, 1:09 p.m.