Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get rid of the repetitive commas of a R string

I have an R string looks like:

0B5P4ZZ, 0B9P40Z, , , , , , , , , , , , , , , , , , , , , , , , , , , ,

How can I get rid of the space-commas at the end of this string so that it looks like the following?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

0B5P4ZZ, 0B9P40Z

Thanks!

>Solution :

Another solution:

str_remove_all(s, "(, )+$")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading