3 ms·
Many lines that don't solve the problem. What I meant: write a boolean test (a function that returns true if x is a string (a "character" vector of length 1) an
by stewbrew 9y ago
Many lines that don't solve the problem. What I meant: write a boolean test (a function that returns true if x is a string (a "character" vector of length 1) and false otherwise) that never throws an error.
- phillc73 9y agoAppreciate this is not Stackoverflow, and happy to take the discussion over there if you would like to raise a question. However, the function I would write is: string_test <- function(x){ is.character(x) && length(x) == 1 } If you can say where that will fail, I'd like to know because it seems like you probably have more experience than I do around this.