Check if Elements of a Vector are non-empty Strings in R Programming – nzchar() Function Last Updated : 01 Jun, 2020 Improve Improve Like Article Like Save Share Report nzchar() function in R Language is used to test whether elements of a character vector are non-empty strings. Syntax: nzchar(x) Parameters: x: character vector Example 1: # R program to illustrate # nzchar function # Initializing a character vector x <- c("GFG", "gfg") y <- c("a", "b", "c") # Calling the nzchar() function nzchar(x) nzchar(y) Output : [1] TRUE TRUE [1] TRUE TRUE TRUE Example 2: # R program to illustrate # nzchar function # Initializing a character vector x <- c("") y <- c("", "") # Calling the nzchar() function nzchar(x) nzchar(y) Output: [1] FALSE [1] FALSE FALSE Like Article Suggest improvement Previous Calculate the difference between Consecutive pair of Elements of a Vector in R Programming - diff() Function Next Printing out to the Screen or to a File in R Programming - cat() Function Share your thoughts in the comments Add Your Comment Please Login to comment...