[R] Avoiding two loops

2011-02-04 Thread sudhir cr
Hello, I have a R code for doing convolution of two functions: convolveSlow <- function(x, y) { nx <- length(x); ny <- length(y) xy <- numeric(nx + ny - 1) for(i in seq(length = nx)) { xi <- x[[i]] for(j in seq(length = ny)) { ij <- i+j-1 xy[[ij

Re: [R] R-help

2011-02-03 Thread sudhir cr
t;O" > [8,] "D" "H" "L" > > t(apply(u, 1, function(x) sort(x))) > [,1] [,2] [,3] > [1,] "J" "M" "W" > [2,] "K" "P" "V" > [3,] "E" "U" "X" >

[R] R-help

2011-02-03 Thread sudhir cr
Hi, I have data like this print(x) ID VAL1VAL2 1 B A 2 P Q 3 T S What I would like is data like this... ID VAL1VAL2 1 A B 2 P Q 3 S T So that VAL1 and VAL2 are alphabetically ordere