Is there a way to determine if an R variable is a single string?
is.character
looked promising, but there was one issue:
is.character(c("a", "b"))
also returned TRUE
which is not what I want.
Based on the comments, this is my current solution:
isSingleString <- function(input) {
is.character(input) & length(input) == 1
}