Copying rows from a matrix using a vector of indices
I don't quite understand what you are asking. Have you checked the sections on "Simple manipulations numbers and vectors", "Arrays and matrices", and "Lists and data frames" in the manual "An Introduction to R"? If you still would like some help after this, PLEASE do read the posting guide! "http://www.R-project.org/posting-guide.html". It can increase the chances that you will get a useful reply. spencer graves
Martin Lam wrote:
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
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Spencer Graves, PhD Senior Development Engineer PDF Solutions, Inc. 333 West San Carlos Street Suite 700 San Jose, CA 95110, USA spencer.graves at pdf.com www.pdf.com <http://www.pdf.com> Tel: 408-938-4420 Fax: 408-280-7915