Re: [R] Indexing problem with matrix

2011-07-22 Thread Bogaso Christofer
Thanks Joshua and Berton for your pointers. Yes it was typo as I wanted to mean to select few columns. -Original Message- From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] Sent: 22 July 2011 22:02 To: Bogaso Christofer Cc: r-help@r-project.org Subject: Re: [R] Indexing problem with

Re: [R] Indexing problem with matrix

2011-07-22 Thread Bert Gunter
See the "drop" argument (and link) in ?"[" -- Bert On Fri, Jul 22, 2011 at 9:46 AM, Bogaso Christofer wrote: > Dear all, assume I have a matrix with just 1 row. Now suppose I want to > fetch 1st few rows from that matrix, however resulting object becomes > vector. Here is 1 such example: > > >

Re: [R] Indexing problem with matrix

2011-07-22 Thread Joshua Wiley
On Fri, Jul 22, 2011 at 9:46 AM, Bogaso Christofer wrote: > Dear all, assume I have a matrix with just 1 row. Now suppose I want to > fetch 1st few rows from that matrix, however resulting object becomes I'm assuming you mean the first few columns. The place to look is ?"[" where you would find

[R] Indexing problem with matrix

2011-07-22 Thread Bogaso Christofer
Dear all, assume I have a matrix with just 1 row. Now suppose I want to fetch 1st few rows from that matrix, however resulting object becomes vector. Here is 1 such example: > matrix(1:5, 1) [,1] [,2] [,3] [,4] [,5] [1,]12345 > > matrix(1:5, 1)[,-1] [1] 2 3 4 5