Operations with Strings
Command strsplit, split the element of a character vector.
"Split" can be a single character, or a character string:
Usage
strsplit (x, split, fixed = FALSE, ...)
Arguments
x character vector, each element of which is to be split.
split character vector containing regular expression(s) (unless fixed = TRUE) to use for splitting.
With a command strsplit, we can split a string in pieces.
> x <- "The&! syntax&! of&! paste&! is&! !&available!& in the online-help"
> x
[1] "The&! syntax&! of&! paste&! is&! !&available!& in the online-help"
> strsplit (x , " ! ")
[ [1] ]
[1] "The&" "syntax&" "of&"
[4] "paste&" "is" "available"
[7] "&inthe online-help"
Command strsplit, split the element of a character vector.
"Split" can be a single character, or a character string:
Usage
strsplit (x, split, fixed = FALSE, ...)
Arguments
x character vector, each element of which is to be split.
split character vector containing regular expression(s) (unless fixed = TRUE) to use for splitting.
With a command strsplit, we can split a string in pieces.
> x <- "The&! syntax&! of&! paste&! is&! !&available!& in the online-help"
> x
[1] "The&! syntax&! of&! paste&! is&! !&available!& in the online-help"
> strsplit (x , " ! ")
[ [1] ]
[1] "The&" "syntax&" "of&"
[4] "paste&" "is" "available"
[7] "&inthe online-help"
0 Comments:
Post a Comment