Skip to content
Back to formatted view

Raw Message

Message-ID: <20050817190207.77099.qmail@web40508.mail.yahoo.com>
Date: 2005-08-17T19:02:07Z
From: Martin Lam
Subject: Copying rows from a matrix using a vector of indices

Hi,

I am trying to use a vector of indices to select some
rows from a matrix. But before I can do that I somehow
need to convert 'combinations' into a list, since
'mode(combinations)' says it's 'numerical'. Any idea
how I can do that?

library("combinat")

combinations <- t(combn(8,2))

indices <- c(sample(1:length(combinations),10))

# convert
???

subset <- combinations[indices]

Thanks in advance,

Martin