Skip to content
Back to formatted view

Raw Message

Message-ID: <68b1e2611001090355p33047b34sc4ccd98d8e8813c0@mail.gmail.com>
Date: 2010-01-09T11:55:07Z
From: Liviu Andronic
Subject: strange behavior of R
In-Reply-To: <1262991466746-1010047.post@n4.nabble.com>

On Fri, Jan 8, 2010 at 10:57 PM, Fahim <fahim.md at gmail.com> wrote:
>> arr
> [1] "y1" "y2"
>
At this moment 'arr' no longer has two dimensions, but only one. So
you can access it only as a vector.

> Problem: I want to access the first row now using:
>>arr[1, ]
> Error in arr[1, 1] : incorrect number of dimensions
>
Correct. It has only one dim.

> Though it is showing the value ?as under:
>> arr[1]
> [1] "y1"
>
>> arr[2]
> [1] "y2"
>
This is how you would access individual elements in vectors.
Liviu