Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-29 Thread Sebastian Bauer
Hi! On 08/24/2011 07:46 PM, David Winsemius wrote: I was looking for an elegant solution ;) In the real case I have double values and this would be quite inefficient then. Still no r-code: Then what about rank(order(...) , further-ties.method-argument) ? I think that, as order() always

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-25 Thread Sebastian Bauer
Hi! On 08/24/2011 07:46 PM, David Winsemius wrote: I was looking for an elegant solution ;) In the real case I have double values and this would be quite inefficient then. Still no r-code: Then what about rank(order(...) , further-ties.method-argument) ? I think that, as order() always

[R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread Sebastian Bauer
Hello, I'd like to rank rows of a data frame similar to what rank() does for vectors. However, ties should be broken by columns that I specify. If it is not possible to break a ties (because the row data is essentially the same), I'd like to have the same flexibility that rank() offers. Is

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread Sebastian Bauer
Hi! I'd like to rank rows of a data frame similar to what rank() does for vectors. However, ties should be broken by columns that I specify. If it is not possible to break a ties (because the row data is essentially the same), I'd like to have the same flexibility that rank() offers. Is

Re: [R] Function rank() for data frames (or multiple vectors)?

2011-08-24 Thread Sebastian Bauer
Hi! in R? Basically, what I need is a mixture of order() and rank(). While the former allows to specify multiple vectors, it doesn't provide the flexibility of rank() such that I can specify what happens if ties can not be broken. An example of this simple problem would clarify this greatly.

[R] Row-wisely converting a data frame into a list

2010-03-02 Thread Sebastian Bauer
Hello, is there an elegant way, how I can convert each row of a data frame into distinct elements of a list? In essence, what I'm looking for is something like rows.to.lists - function( df ) { ll - NULL for( i in 1:nrow(df) ) ll - append( ll, list(df[i,]) )

Re: [R] Row-wisely converting a data frame into a list

2010-03-02 Thread Sebastian Bauer
Hi! On 03/02/2010 02:22 PM, Nutter, Benjamin wrote: as.data.frame(t(df)) For example x- as.data.frame(t(mtcars)) typeof(x) [1] list Thanks for the quick reply! I would never have guessed that as.data.frame() works that way! BTW This one seems also to do the trick: rows.to.list -

[R] Thread-safeness of unif_rand()?

2010-02-12 Thread Sebastian Bauer
Hello, I'm currently using the unif_rand() function of R to get a random number from the uniform distribution in the C-part of a R package. The unif_rand() is heavily used. Now I would like to spawn several threads within the package in which the function is also heavily used. Is it safe and