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.