Last data update: 2014.03.03

R: Zero characters or NULL
nchar0R Documentation

Zero characters or NULL

Description

Returns TRUE if (is.null(x) || (length(x) == 0) || (max(nchar(x)) == 0)).

Usage

nchar0(x, ...)

Arguments

x

a character vector or something that can be coerced to mode character

...

optional arguments to be passed to nchar

Value

TRUE if x is either NULL or max(nchar(x)) == 0. FALSE otherwise.

Author(s)

Spencer Graves

See Also

nchar

Examples


all.equal(nchar0(NULL), TRUE)



all.equal(nchar0(character(0)), TRUE)



all.equal(nchar0(character(3)), TRUE)



all.equal(nchar0(c('a', 'c')), FALSE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Ecfun)

Attaching package: 'Ecfun'

The following object is masked from 'package:base':

    sign

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Ecfun/nchar0.Rd_%03d_medium.png", width=480, height=480)
> ### Name: nchar0
> ### Title: Zero characters or NULL
> ### Aliases: nchar0
> ### Keywords: manip
> 
> ### ** Examples
> 
> ## Don't show: 
> stopifnot(
+ ## End(Don't show)
+ all.equal(nchar0(NULL), TRUE)
+ ## Don't show: 
+ )
> ## End(Don't show)
> 
> ## Don't show: 
> stopifnot(
+ ## End(Don't show)
+ all.equal(nchar0(character(0)), TRUE)
+ ## Don't show: 
+ )
> ## End(Don't show)
> 
> ## Don't show: 
> stopifnot(
+ ## End(Don't show)
+ all.equal(nchar0(character(3)), TRUE)
+ ## Don't show: 
+ )
> ## End(Don't show)
> 
> ## Don't show: 
> stopifnot(
+ ## End(Don't show)
+ all.equal(nchar0(c('a', 'c')), FALSE)
+ ## Don't show: 
+ )
> ## End(Don't show)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>