[R] strange behavior of R

Liviu Andronic landronimirc at gmail.com
Sat Jan 9 12:55:07 CET 2010


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



More information about the R-help mailing list