Many thanks for this example, which doesn't entirely cover my case since I
have as many "indexes" entries as "sequences" entries. It was very
educational none the less and I used it to come up with something a bit
faster than what I had before. The main trick I used though was naming all
entrie
Try this one; it is doing a list of 7000 in under 2 seconds:
> sequences <- list(
+
+
+ c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T","Y","L","L","I"
+ ,"M",
+
+
+ "N","H","K","L","L","L","I","N","N","N","N","L","T","E","V","H","T","Y","F",
"N","I","N","I","N","I","D","K","M","Y","
Thanks. Very elegant, but doesn't solve the problem of the outer "for" loop,
since I now would rewrite the code like so:
fragments <- list()
for(iN in seq(length(sequences))){
cat(paste(iN,"\n"))
fragments[[iN]] <-
lapply(indexes[[1]], function(g)sequences[[1]][do.call(seq, as.list(g))])
Try this:
lapply(indexes[[1]], function(g)sequences[[1]][do.call(seq, as.list(g))])
On Fri, Jan 16, 2009 at 11:06 AM, Johannes Graumann <
johannes_graum...@web.de> wrote:
> Hello,
>
> I have a list of character vectors like this:
>
> sequences <- list(
>
>
> c("M","G","L","W","I","S","F","G","
Dear Johannes,
Try this:
sequences <- c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T",
"Y","L","L","I","M","N","H","K","L","L","L","I","N","N","N","N","L","T","E","V",
"H","T","Y","F","N","I","N","I","N","I","D","K","M","Y","I","H","*")
indexes <- matrix(c(1,22,22,46,46,51,1,46,22,51,1
Hello,
I have a list of character vectors like this:
sequences <- list(
c("M","G","L","W","I","S","F","G","T","P","P","S","Y","T","Y","L","L","I","M",
"N","H","K","L","L","L","I","N","N","N","N","L","T","E","V","H","T","Y","F",
"N","I","N","I","N","I","D","K","M","Y","I","H","*")
)
and ano
6 matches
Mail list logo