[Rd] "[.data.frame" forgets about "AsIs" (PR#665)

maechler@stat.math.ethz.ch maechler@stat.math.ethz.ch
Thu, 21 Sep 2000 10:18:33 +0200 (MET DST)


Short example:

 > str(d <- data.frame(a = I(letters[1:5])))
 `data.frame':	5 obs. of  1 variable:
  $ a:Class 'AsIs'  chr [1:5] "a" "b" "c" "d" ...
 > str(d[TRUE,,drop = FALSE])
 `data.frame':	5 obs. of  1 variable:
  $ a: chr  "a" "b" "c" "d" ...

The real problem about this is, that as soon as the data.frame is further
"transformed", the character component is coerced to a factor, e.g.

   > str(rbind(d[TRUE,,drop = FALSE], "E"))
   `data.frame':	6 obs. of  1 variable:
    $ a: Factor w/ 6 levels "a","b","c","d",..: 1 2 3 4 6 5

--- 

I'm looking at a fix myself.

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._