Extract Substring from a String in R

Learn to extract Substring from a String in R programming language using substring() function.

Extract Substring from a String in R

Syntax of R substring function

substring(c, first, last)

where :

c is the string
first is the starting position of substring (in the main string) to be extracted
last is the ending position of substring (in the main string) to be extracted. last is optional, in which case last is taken as whole length of the string.

 

Example to extract Substring from a String in R

 

Example to extract Substring from a String in R without last position provided

 

Conclusion :

In this R Tutorial, we have learnt to find Substring from a String in R programming language using substring() function.