View source: R/sbtab_utilities.R
ftsplit | R Documentation |
This function splits a string like strsplit, but it removes whitespace from the result (on both ends) and the split token is taken literally
ftsplit(str, s = " ", re = FALSE)
str |
a string (character vector of length 1) |
s |
a split token |
re |
defaults to FALSE, if TRUE s is treated as a regular expression |
a character vector of the components without leading or trailing whitespace
ftsplit(" A + 2*B ","+")
[1] "A" "2*B"
x<-c('a+b','c+d','1 + 2'); lapply(x,ftsplit,'+')
[[1]]
[1] "a" "b"
[[2]]
[1] "c" "d"
[[3]]
[1] "1" "2"
this also works, but mixes up the components:
x<-c('a+b','c+d+1','1 / 2'); ftsplit(x,'+')
[1] "a" "b" "c" "d" "1" "1 / 2"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.