Hi,
I found this code simple and easy.
is_palindrome <- function(word) {
library(stringr)
split_word <- unlist((str_split(word, pattern = "")))
reverse_word <- split_word[str_length(word):1]
paste_word <- paste(reverse_word, collapse = "")
cat(word == paste_word)
}
is_palindrome("bob")