The elemental check for empty text seems incorrect
jrwishart opened this issue · 1 comments
jrwishart commented
The check for empty input seems to always return the first element since the grepl
call is wrapped in any
is_it()$empty
function (x)
{
any(grepl("^\\s*$", stats::na.omit(x)))
}
<bytecode: 0x000001c20c124b50>
<environment: namespace:textclean>
A related point is the na.omit
will mess up the indexing if NA
values exist in the input vector.
E.g.
x <- c("This is ok", NA, "", " ", "This is also ok")
is_it()$empty(x)
Desired function would seem to be
is_it()$empty <- function (x)
{
grepl("^\\s*$", x)
}
Unless this has implications elsewhere?
trinker commented
Thanks for the issue. Should be fixed now.