I am trying to return null using ifelse in R. But it throws an error message. Any suggestion please.
Here is my code:
cntr1 <- ifelse(unlist(gregexpr("---",path_info[j], fixed = TRUE, useBytes = TRUE)) > 0, 3 * length(unlist(gregexpr("---",path_info[j], fixed = TRUE, useBytes = TRUE))),NULL )
Error message is:
Error in ifelse(unlist(gregexpr("---", path_info[j], fixed = TRUE, useBytes = TRUE)) > :
replacement has length zero In addition: Warning message:
In rep(no, length.out = length(ans)) :
'x' is NULL so the result will be NULL