lundi 20 avril 2015

Extract part of string (till the first semicolon) in R

I have a column containing values of 3 strings separated by semicolons. I need to just extract the first part of the string.

Type <- c("SNSR_RMIN_PSX150Y_CSH;SP_12;I0.00V50HX0HY3000")

What I want is: Get the first part of the string (till the first semicolon).

Output : SNSR_RMIN_PSX150Y_CSH

I tried gsub but not able to understand. Kindly let me know how we can do this efficiently in R.

Aucun commentaire:

Enregistrer un commentaire