strsplit() method in R programming is used to split the string by using delimiter.
Syntax:
strsplit(string, delimiter)Return: Returns the list of words or sentences after split.
Example 1:
# R program to split a string # Given String gfg <- "Geeks For Geeks" # Using strsplit() method answer <- strsplit(gfg, " ") print(answer) |
chevron_right
filter_none
Output:
[1] "Geeks" "For" "Geeks"
Example 2:
# R program to split a string # Given String gfg <- "The quick brown fox jumps over the lazy dog" # Using strsplit() method answer <- strsplit(gfg, " ") print(answer) |
chevron_right
filter_none
Output:
[1] "The" "quick" "brown" "fox" "jumps" "over" "the" "lazy" "dog"
Recommended Posts:
- Concatenate Two Strings in R programming - paste() method
- Check if Elements of a Vector are non-empty Strings in R Programming - nzchar() Function
- Print Strings without Quotes in R Programming - noquote() Function
- Formatting Numbers and Strings in R Programming - format() Function
- Finding the length of string in R programming - nchar() method
- Performing Binomial Test in R programming - binom.test() Method
- Performing F-Test in R programming - var.test() Method
- Replicate elements of vector in R programming - rep() Method
- Adding elements in a vector in R programming - append() method
- Convert String from Uppercase to Lowercase in R programming - tolower() method
- Calculate the absolute value in R programming - abs() method
- Getting the Modulus of the Determinant of a Matrix in R Programming - determinant() Function
- Set or View the Graphics Palette in R Programming - palette() Function
- tidyr Package in R Programming
- Get Exclusive Elements between Two Objects in R Programming - setdiff() Function
- Intersection of Two Objects in R Programming - intersect() Function
- Add Leading Zeros to the Elements of a Vector in R Programming - Using paste0() and sprintf() Function
- Clustering in R Programming
- Compute Variance and Standard Deviation of a value in R Programming - var() and sd() Function
- Compute Density of the Distribution Function in R Programming - dunif() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

