Skip to content
Prev 205817 / 398506 Next

strange behavior of R

Hi 
I observed an interesting behavior of R. Can you find where is the bug, or
it is not a bug but made deliberately.
- Hide quoted text -
Everything ok upto this point, arr content is displayed as follows
[,1] [,2]
a "x1" "x2"
b "y1" "y2"

Now I delete any row:
arr = arr[-1,];

The value of arr is :
[1] "y1" "y2"

Problem: I want to access the first row now using:
Error in arr[1, 1] : incorrect number of dimensions

Though it is showing the value  as under:
[1] "y1"
[1] "y2"


I think, when there is single row, R is considering it as an array and not
as matrix. But why it is so?????????????/
 

-Fahim