s-news
[Top] [All Lists]

Inconsistency of TABLE and DATA.FRAME?

To: s-news@wubios.wustl.edu
Subject: Inconsistency of TABLE and DATA.FRAME?
From: Pierre.Ilouga@evotecoai.com
Date: Fri, 23 Nov 2001 19:10:45 +0100
Hallo everyone.
The  very simple  SPLUS example I would like to present is the following:
 I'm dealing with a table X  of length 5.

> X
   2    8  10  16  24
 105 63 30 46  1
> names(X)
[1] "2"  "8"  "10" "16" "24"
> X["2"]
   2
 105

I want now  to extract the table position with the name "1" (which of
course doesn't exists)

> X["1"]
Problem in X["1"]: Array subscript (6) out of bounds, should be at most 5
Use traceback() to see the call stack

The  convertion of  the table X  in a data.frame  Y yields:
> Y<-data.frame(X)
> Y
          X
 2     105
 8      63
10      30
16      46
24       1

and

> Y["1",]
[1] NA
> version
Version 6.0 Release 1 for Linux 2.2.12 : 2000


I computed the same example on the same machine with R. The results are
listed below.

> X
  2   8  10  16  24
105  63  30  46   1
>  names(X)
[1] "2"  "8"  "10" "16" "24"
> X["2"]
   2
 105
> X["1"]
NA
NA
> Y<-data.frame(X)
>  Y
     X
2      105
8       63
10      30
16      46
24       1
> Y["1",]
NA
NA

> version
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    3.1
year     2001
month    08
day      31
language R

My aim is not  to compare the performances of Splus and R. But, according
to this simple  example, I suppose some lack of consistency in  SPLUS
between table and data.frame.

Regards.

Dr. Pierre Ilouga
EVOTEC OAI
Screening Operations/Discovery Informatics
Schnackenburgallee 114
D-22525 Hamburg
Germany


<Prev in Thread] Current Thread [Next in Thread>
  • Inconsistency of TABLE and DATA.FRAME?, Pierre . Ilouga <=