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,100 points
19 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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,550 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,550 points
1,514 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,550 points
29 views
0 votes
1 answer

How to extract specific columns from a DataFrame ?

Yes there are so many ways: df[,c(V2,V4)] and another ...READ MORE

answered Apr 11, 2018 in Data Analytics by DeepCoder786
• 1,700 points
356 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,100 points
30 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 18, 2018 in Data Analytics by Bharani
• 4,550 points
67 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,000 points
13 views
0 votes
1 answer

Python Regex Search And Replace

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

answered 6 days ago in Python by SDeb
• 9,660 points
7 views
+1 vote
1 answer

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

This code gives the total number of ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,550 points
19 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,550 points
44 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.