Check palindrome or not in R

0 votes
How to check palindrome or not in R?

Im new to R. I want to check if user names whether they are palindrome.
Aug 20 in Data Analytics by sirish
31 views

1 answer to this question.

0 votes

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")
answered Aug 20 by anonymous
• 31,840 points

Related Questions In Data Analytics

0 votes
1 answer
0 votes
1 answer

Check if the object(variable) is defined in R

You can use the exists(): > exists("toFindUnknown") [1] FALSE > ...READ MORE

answered Apr 17, 2018 in Data Analytics by darklord
• 6,170 points
58 views
0 votes
1 answer

Is there any way to check for missing packages and install them in R?

There are 2 options: Either you can use ...READ MORE

answered Apr 17, 2018 in Data Analytics by nirvana
• 3,060 points
54 views
0 votes
1 answer

SMOTE-function not working in R

If you convert 'y' to a factor, ...READ MORE

answered Jun 26, 2018 in Data Analytics by CodingByHeart77
• 3,690 points
457 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
115 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
158 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points
85 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
103 views
0 votes
1 answer

How to check if a file already exists or not in R?

Check out file.exists() function!! The function file.exists() returns a ...READ MORE

answered Oct 29 in Data Analytics by Cherukuri
• 31,840 points
20 views
0 votes
2 answers

R Package installed or not

To see all installed packages in system ...READ MORE

answered Jun 27 in Data Analytics by anonymous
• 31,840 points
23 views