Re: [R] Copying rows from a matrix using a vector of indices

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Wed 24 Aug 2005 - 10:01:32 EST

          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@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@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
R-help@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
Received on Wed Aug 24 10:09:33 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:48:30 EST