Displaying 2 results from an estimated 2 matches for "splitaslist".
2017 Jun 27
0
paste strings in C
...oo3 <- function(mymat, colnms, tilde=FALSE) {
mymat <- t(mymat)
chars <- colnms[row(mymat)]
lowerChars <- if (tilde) paste0("~", chars) else tolower(chars)
chars <- ifelse(mymat==1L, lowerChars, chars)
keep <- mymat > 0L
charList <- IRanges::splitAsList(chars[keep], col(chars)[keep])
S4Vectors::unstrsplit(charList, "*")
}
Michael
On Tue, Jun 27, 2017 at 5:29 AM, Adrian Du?a <dusa.adrian at unibuc.ro> wrote:
> Dear R-devs,
>
> Below is a small example of what I am trying to achieve, that is trivial in
> R and I wou...
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