could_this_be_that {hablar}R Documentation

Tests is a vector could be of another data type

Description

Tests if vector could be a another data type without errors.

Usage

could_chr_be_num(.x)

could_chr_be_int(.x)

could_num_be_int(.x)

could_chr_be_dtm(.x)

could_chr_be_dte(.x)

Arguments

.x

vector of the data type that should be tested.

Details

The name logic of could_chr_be_num should be interpreted as: Could this character vector be a numeric vector? The same logic goes for all functions named could_this_be_that.

Value

TRUE or FALSE

See Also

vignette("s"), vignette("hablar")

Examples

x <- c("1", "3", "7")
could_chr_be_num(x)
could_chr_be_int(x)

x <- c("abc", "3", "Hello world")
could_chr_be_num(x)

x <- c(NA, "3.45", "5,98")
could_chr_be_num(x)
could_chr_be_int(x)

x <- as.numeric(c(3.45, 1.5))
could_num_be_int(x)

x <- as.numeric(c(7, 2))
could_num_be_int(x)


[Package hablar version 0.3.2 Index]