Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 209026

test for named character(0) vector in R

$
0
0

I have a function which returns the following vector in R

vec
#named character(0)

Since it is a named vector, I am not able to test the following on it

is.na()

is.na(vec)
# named logical(0)

is.null

is.null(vec)
# [1] FALSE

identical(vec,character(0)

identical(vec,character(0)
# [1] FALSE

How do I write a test on it to check if it is a named character(0) vector and then assign it to a NULL value?


Viewing all articles
Browse latest Browse all 209026

Latest Images

Trending Articles



Latest Images