From jens.oehlschlaegel-akiyoshi@mdfactory.de  Wed Mar  8 09:16:39 2000
From: jens.oehlschlaegel-akiyoshi@mdfactory.de (=?iso-8859-1?Q?Jens_Oehlschl=E4gel-Akiyoshi?=)
Date: Wed, 8 Mar 2000 10:16:39 +0100
Subject: [Rd] possible BUG with as.data.frame() and/or [.data.frame
Message-ID: <000501bf88df$039febc0$a9021aac@joelschlaegel>



Here is a possible BUG with as.data.frame() and/or [.data.frame which broke
Michael Lapsleys RODBC-Code.
Can anyone confirm it is a bug or a 'feature' of the prototype?


tablename <- "abc"
a <- as.data.frame(cbind("abc", 1:3))
b <- as.data.frame(cbind(tablename, 1:3))

# ok
> a
   V1 V2
1 abc  1
2 abc  2
3 abc  3

# missing column name
> b
  tablename
1       abc 1
2       abc 2
3       abc 3

# subsetting ok
> b[1,1]
[1] abc
Levels:  abc

# subsetting fails
> b[1,2]
Error in [.data.frame(b, 1, 2) : undefined columns selected


##by contrast
> data.frame(cbind(tablename, 1:3))
  tablename Var.2
1       abc     1
2       abc     2
3       abc     3

Regards


--
Dr. Jens Oehlschlgel-Akiyoshi
MD FACTORY GmbH
Bayerstrasse 21

80335 Mnchen

Tel.: 089 545 28-27
Fax.: 089 545 28-10
http://www.mdfactory.de

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] possible BUG with as.data.frame() and/or [.data.frame
=?iso-8859-1?Q?Jens_Oehlschl=E4gel-Akiyoshi?=