R

Asked • 10/09/19

How to extract a substring in R according to a pattern?

Suppose I have a list of string: `string = c("G1:E001", "G2:E002", "G3:E003")`. Now I hope to get a vector of string that contains only the parts after the colon ":", i.e `substring = c(E001,E002,E003)`. Is there a convenient way in R to do this? Using `substr`? Thanks!

1 Expert Answer

By:

Robert S. answered • 11/24/19

Tutor
5.0 (186)

R Developer and Analyst

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.