Oh, this seemed so simple (and I'm sure the answer will be, as usual, so
thanks in advance for enlightening me). I need to sort each row of a matrix
independent of the others. For example,
test - matrix(c(8,7,1,2,6,5,9,4,3),nrow=3)
test
[,1] [,2] [,3]
[1,]829
[2,]76
Got the answer:
t(apply(test,1,sort))
I had played with the apply fn at one point, but noticed the results were
not quite right. Wrapping it in t was the trick! Thanks!
Now to use the nicely sorted rows in my real problem at hand...
Cheers,
Kev-
--
View this message in context:
I'm completely stumped and seem to be going around for 2 days in the wrong
circles. Here's what I have in 2 dataframes:
dim(params.data); head(params.data, n=2)
[1] 284 6
itema1a2 b1 b2 c
11 0.6671587 0.9588642 -3.5 -3.437961 0.2
22 1.1296298 1.4899307 -3.5
3 matches
Mail list logo