On Wed, 2011-11-16 at 14:55 -0800, Peter Ehlers wrote:
> I must be missing something. What's wrong with
>
> t(apply(mat, 1, sample))
>
> ?
Only missing that I am either[*] i) stupid, ii) being too clever, iii)
down on my coffee intake for the day.
G
[*] delete as applicable any that don't ap
Seems logical to me -- and, Juan, sorry for messing up earlier -- read
too hastily.
Michael
On Wed, Nov 16, 2011 at 5:55 PM, Peter Ehlers wrote:
> I must be missing something. What's wrong with
>
> t(apply(mat, 1, sample))
>
> ?
>
> Peter Ehlers
>
> On 2011-11-16 12:12, Gavin Simpson wrote:
>>
I must be missing something. What's wrong with
t(apply(mat, 1, sample))
?
Peter Ehlers
On 2011-11-16 12:12, Gavin Simpson wrote:
On Wed, 2011-11-16 at 14:29 -0500, R. Michael Weylandt wrote:
Suppose your matrix is called X.
? sample
X[sample(nrow(X)),]
That will shuffle the rows at rando
On Wed, 2011-11-16 at 14:29 -0500, R. Michael Weylandt wrote:
> Suppose your matrix is called X.
>
> ? sample
> X[sample(nrow(X)),]
That will shuffle the rows at random, not permute within the rows.
Here is an alternative, first using one of my packages (permute -
shameful promotion ;-) !:
mat
Suppose your matrix is called X.
? sample
X[sample(nrow(X)),]
Michael
On Wed, Nov 16, 2011 at 11:45 AM, Juan Antonio Balbuena wrote:
> Hello
> This is probably a basic question but I am quite new to R.
>
> I need to permute elements within rows of a binary matrix, such as
>
> [,1] [,2] [,3]
Hello
This is probably a basic question but I am quite new to R.
I need to permute elements within rows of a binary matrix, such as
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]000010000 0
[2,]001100011
6 matches
Mail list logo