Displaying 2 results from an estimated 2 matches for "unstrsplit".
Did you mean:
strsplit
2017 Jun 27
0
paste strings in C
...(mymat, colnms, tilde=FALSE) {
chars <- colnms[col(mymat)]
lowerChars <- if (tilde) paste0("~", chars) else tolower(chars)
chars <- ifelse(mymat==1L, lowerChars, chars)
keep <- mymat > 0L
charList <- split(chars[keep], row(chars)[keep])
S4Vectors::unstrsplit(charList, "*")
}
Or perhaps more efficient using the compressed lists of IRanges:
foo3 <- function(mymat, colnms, tilde=FALSE) {
mymat <- t(mymat)
chars <- colnms[row(mymat)]
lowerChars <- if (tilde) paste0("~", chars) else tolower(chars)
chars <...
2017 Jun 27
2
paste strings in C
Dear R-devs,
Below is a small example of what I am trying to achieve, that is trivial in
R and I would like to learn how to do in C, for very large matrices:
> (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2))
[,1] [,2] [,3]
[1,] 1 0 2
[2,] 0 2 1
And I would like to produce:
[1] "a*C" "B*c"
Which can be trivially done in R via something like:
foo