View source: R/vector2string.R
vector2string | R Documentation |
LIMITATION: The function interprets all substrings in the vector either as of type 'int' or 'char'. A function that interprets the type of each substring dynamically may one day be written by an R-guru.
vector2string(
vector = c(" 12345", "4X3200", "1X2890"),
SS = "', '",
type = "char"
)
vector |
integer or character vector |
SS |
User-specified string separator. (default value: SS = "', '"). |
type |
Tell function the class of the |
Franc Brglez, Wed Dec 9 15:43:59 EST 2009
library(stringi, quietly = TRUE)
## Here we convert a binary vector to a binary string representing an integer:
binV <- c(1, 0, 0, 1)
strS <- vector2string(binV, type = "int")
## Here we convert a binary vector to string representing a binary sequence:
binV <- c(1,0,0,1)
seqS <- vector2string(binV, SS=" ", type="char")
## Here we convert a vector of substrings to colon-separated string:
subsV <- c("I", "am", "done")
strS <- vector2string(subsV, SS = ":", type = "char")
## Making an SQL IS IN statement
ids <- c(" 12345", "4X3200", "1X2890")
stri_c("and master.id in ('", vector2string(ids, "', '"), "') ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.