Learn R Programming

str2str (version 1.0.0)

is.empty: Test for Empty Characters

Description

is.empty returns whether elements of a character vector are empty (i.e., "").

Usage

is.empty(x, trim = FALSE)

Value

TRUE for every element of `x` that is empty (i.e., "") and FALSE otherwise. The structure is a logical vector with length = length(`x`) and names = names(`x`).

Arguments

x

character vector.

trim

logical vector with a single element specifying whether white spaces should be trimmed from the character vector. See trimws.

Examples

Run this code
v <- c("1", " ", "")
is.empty(v)

Run the code above in your browser using DataLab