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
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:
>
>
>
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
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
4 matches
Mail list logo