Removing all white-spaces from a string

0 votes
I have a string alphabets -> "aa bb cc dd ee ff gg". I would want to remove all the white-spaces in the string and get the resultant string as "aabbccddeeffgg".
May 16, 2018 in Data Analytics by DataKing99
• 8,250 points
626 views

1 answer to this question.

0 votes

You can use the 'str_replace_all()' function from the stringr package:

library(stringr)
str_replace_all(alphabets," ","")->alphabets
> alphabets
[1] "aabbccddeeffgg"
answered May 16, 2018 by Bharani
• 4,660 points

Related Questions In Data Analytics

0 votes
1 answer

Removing outliers from a box-plot - ggplot2 - R

You just have to add 'outlier.shape=NA' inside ...READ MORE

answered May 31, 2018 in Data Analytics by Bharani
• 4,660 points
24,829 views
0 votes
0 answers

Split a string and store it in multiple columns from a field in R

How to Split a string and store ...READ MORE

Jun 29, 2019 in Data Analytics by Anand
886 views
0 votes
1 answer

Create a new string from existing strings in different variables

Its quite simple, Use paste function as ...READ MORE

answered Oct 31, 2019 in Data Analytics by Cherukuri
• 33,030 points
915 views
0 votes
1 answer

Find length of string in R

You can try nchar > nchar("fast") [1] 4 > set.seed(10) > ...READ MORE

answered Apr 17, 2018 in Data Analytics by DataKing99
• 8,250 points
1,154 views
0 votes
1 answer

Converting a string to title case - R

library(tools) toTitleCase("this is sparta") [1] "this is Sparta" ...READ MORE

answered May 19, 2018 in Data Analytics by Bharani
• 4,660 points
1,586 views
0 votes
1 answer

R programming logic

Use gsub to match the substring that we want ...READ MORE

answered Nov 16, 2018 in Data Analytics by Maverick
• 10,840 points
765 views
0 votes
1 answer

Python Regex Search And Replace

You need not use a regex. Your ...READ MORE

answered May 20, 2019 in Python by SDeb
• 13,300 points
1,085 views
+1 vote
2 answers

Finding number of missing values and removing those missing values from a data-frame

To find number of missing values for ...READ MORE

answered Aug 14, 2019 in Data Analytics by anonymous
1,115 views
0 votes
1 answer

Removing all objects from work-space except one - R

You can use the 'keep()' function from ...READ MORE

answered May 17, 2018 in Data Analytics by Bharani
• 4,660 points
1,238 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP