From a296180@agate.fmr.com  Wed May 29 15:33:19 2002
From: a296180@agate.fmr.com (David Kane  <David Kane)
Date: Wed, 29 May 2002 10:33:19 -0400
Subject: warning message for setAs when using class AsIs
Message-ID: <15604.59055.655673.283148@gargle.gargle.HOWL>

This seemed too advanced for r-help and is related to the recent discussion of
character vectors in dataframes.

Following Brian Ripley's most excellent advice, we are moving to a world in
which character vectors in dataframes are always of class AsIs. The cool way of
doing this seemed to be the following:

> cat(c("x", "y", "z"), file = "test.txt", sep = "\n")
> x <- read.table("test.txt")
> class(x$V1)
[1] "factor"

This is what we expect.

> library(methods)
> setAs('character', "AsIs", function(from) I(from))
Warning message: 
Class "AsIs"not defined in: matchSignature(fnames, signature, fdef) 
>

This warning seems wrong to me, although I am not smart enough to follow the
logic through the underlying code. It *seems* as if setAs does not consider
`AsIs' to be an allowed class. However, the desired effect is achieved.

> x <- read.table("test.txt", colClasses=c("AsIs"))
> x
  V1
1  x
2  y
3  z
> class(x$V1)
[1] "AsIs"      "character"
> unlink("test.txt")
> R.version
         _                   
platform sparc-sun-solaris2.6
arch     sparc               
os       solaris2.6          
system   sparc, solaris2.6   
status                       
major    1                   
minor    5.0                 
year     2002                
month    04                  
day      29                  
language R                   
> 

Any comments/suggestions would be much appreciated.

Thanks,

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


warning message for setAs when using class AsIs
David Kane  <David Kane