nn: Replace NULL with character()

View source: R/nn.R

nnR Documentation

Replace NULL with character()

Description

Internal function: return character(0) instead of NULL. This is sometimes needed not to return error when applying some functions.

Usage

nn(x)

Arguments

x

Input variable

Value

character(0) if x==NULL, x elsewhere

Note

License: GPL 3.0

Author(s)

Luigi Ranghetti, phD (2019) luigi@ranghetti.info

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. doi: 10.1016/j.cageo.2020.104473, URL: https://sen2r.ranghetti.info/.

Examples

tryCatch(basename(NULL), error = print) # error
basename(character()) # ok
basename(sen2r:::nn(NULL)) # ok

sen2r documentation built on Sept. 22, 2022, 5:06 p.m.