Learn R Programming

tester (version 0.2.0)

is_matrix: Is matrix

Description

is_matrix tests if an object is a matrix
is_numeric_matrix tests if an object is a numeric matrix
is_string_matrix tests if an object is a string matrix
is_logical_matrix tests if an object is a logical matrix
is_not_matrix tests if an object is not a matrix

Arguments

x

an R object

Examples

Run this code
A = matrix(1:10, 5, 2)
B = matrix(letters[1:10], 5, 2)
C = 1:10

is_matrix(A) # TRUE
is_matrix(C) # FALSE
is_not_matrix(C) # TRUE

is_numeric_matrix(A) # TRUE
is_numeric_matrix(B) # FALSE

is_string_matrix(A) # FALSE
is_string_matrix(B) # TRUE

Run the code above in your browser using DataLab