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

R: extract an element after a symbol "="

i have an example like this :

M01287=Neuro D

and I want to extract only one element after "=" : 'Neuro'

i tried this command, but it gives me everything after "=" :

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

sub('.*=', '', data$V4) -> Neuro D

Do you have a suggestion! thank you in advance

>Solution :

You can add a second condition to remove everything after space :

gsub('.*=| .*', '', 'M01287=Neuro D')
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