Description Usage Arguments Details Value See Also Examples
This function returns TRUE if the variable type is correct and FALSE
otherwise. Depending on the type, a number of other attributes can be checked
simultaneously, such as length, using n, or size of rows and columns, using
n_row and n_col respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | 
x | 
 (any) The object to test.  | 
type | 
 (character) The allowed type.  | 
n | 
 (integer, optional) The allowed length. If   | 
class | 
 (character) The allowed class.  | 
levels | 
 (character, optional) The allowed levels. If   | 
dims | 
 (integer, optional) The allowed dimension sizes. If   | 
n_col | 
 (integer, optional) The allowed number of columns. If   | 
n_row | 
 (integer, optional) The allowed number of rows. If   | 
The following types can be checked:
is_type(): 'x"' must have type type and optionally length n.
is_class(): 'x"' must have class class and optionally length n.
is_natural(): 'x' must be a positive integer vector and optionally length
n.
is_number(): 'x' must be a numeric vector and optionally length n.
is_factor(): 'x' must be a factor vector and optionally length n.
is_array(): 'x' must be an array and optionally have dimension size
dims.
is_matrix(): 'x' must be a matrix and optionally have number of columns
n_col and number of rows n_row.
is_data_frame(): 'x' must be a data.frame and optionally have number of
columns n_col and number of rows n_row.
TRUE if x is a valid URL, FALSE otherwise
rlang::is_null(), rlang::is_atomic(), rlang::is_vector(),
rlang::is_logical(), rlang::is_integer(), rlang::is_double(),
rlang::is_character(), rlang::is_raw(), rlang::is_bytes(),
rlang::is_list()
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67  | # TRUE
is_type(1:3, "integer")
is_type(data.frame(a = 1:26, b = letters), "list")
is_type(1:3, "integer", n = 3)
# FALSE
is_type(data.frame(a = 1:26, b = letters), "data.frame")
is_type(1:3, "integer", n = 1)
# TRUE
is_class(1:3, "integer")
is_class(data.frame(a = 1:26, b = letters), "data.frame")
is_class(1:3, "integer", n = 3)
# FALSE
is_class(data.frame(a = 1:26, b = letters), "list")
is_class(1:3, "integer", n = 1)
# TRUE
is_natural(1:3)
is_natural(c(1.0, 2.0))
is_natural(1:3, n = 3)
# FALSE
is_natural(-1:-3)
is_natural(3.142)
is_natural(1:3, n = 1)
# TRUE
is_number(1:3)
is_number(c(1.2, 2.4))
is_number(1:3, n = 3)
# FALSE
is_number("text")
is_number(1:3, n = 1)
# TRUE
is_factor(factor(c("a", "b", "a")))
is_factor(factor(c("a", "b", "a")), n = 3)
is_factor(factor(c("a", "b", "a")), levels = c("a", "b"))
# FALSE
is_factor(1:3)
is_factor(factor(c("a", "b", "a")), n = 1)
is_factor(factor(c("a", "b", "a")), levels = c("A", "B"))
# TRUE
is_array(array(1:3))
is_array(array(1:12, dim = c(3, 4)))
is_array(array(1:12, dim = c(3, 4)), dims = c(3, 4))
# FALSE
is_array(1:3)
is_array(array(1:12, dim = c(3, 4)), dims = c(4, 3))
# TRUE
is_matrix(matrix(1:3))
is_matrix(matrix(1:12, nrow = 3, ncol = 4), n_col = 4)
is_matrix(matrix(1:12, nrow = 3, ncol = 4), n_row = 3)
# FALSE
is_matrix(1:3)
is_matrix(matrix(1:12, nrow = 3, ncol = 4), n_col = 3)
is_matrix(matrix(1:12, nrow = 3, ncol = 4), n_row = 4)
# TRUE
is_data_frame(data.frame(a = 1:26, b = letters))
is_data_frame(data.frame(a = 1:26, b = letters), n_col = 2)
is_data_frame(data.frame(a = 1:26, b = letters), n_row = 26)
# FALSE
is_data_frame(list(a = 1:26, b = letters))
is_data_frame(data.frame(a = 1:26, b = letters), n_col = 5)
is_data_frame(data.frame(a = 1:26, b = letters), n_row = 5)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.