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
12 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
• 25,900 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,140 points
49 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
43 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,680 points
376 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,700 points
97 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,700 points
118 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,700 points
76 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,700 points
70 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
• 25,900 points
19 views
0 votes
1 answer

fetch all rows with null values in dataframe or dataset - R

Use below code -  which(is.na(air)) is.na() will return a boolean ...READ MORE

answered Jul 4 in Data Analytics by anonymous
• 25,900 points
21 views