R-beta: bugs and problems

Jim Lindsey (jlindsey@luc.ac.be)
Tue, 2 Jun 1998 09:12:58 +0200 (MET DST)

From: Jim Lindsey <jlindsey@luc.ac.be>
Message-Id: <9806020712.AA26573@alpha.luc.ac.be>
Subject: R-beta: bugs and problems
To: r-help@stat.math.ethz.ch (r-help)
Date: Tue, 2 Jun 1998 09:12:58 +0200 (MET DST)

The following are with R0.61.2 under Red Hat 5.

If an MS-DOS file with CRs still in place is (accidently) read into
R using scan(), an extra zero is added to each line. This can be very

In manipulating repeated measurements data, I generally require
matrices. Unfortunately, matrix factors create a lot of problems.
Consider the following simple examples:

> x <- as.factor(c("F","N",NA))
> y <- cbind(x,x)
> y[,1]
Error: length of "levels" vector and number of levels differ
> attributes(y)$levels <- NULL
> is.factor(y)
> y[,1]

> rbind(NULL,gl(2,1,2))
Error in rbind(NULL,gl(2,1,2)): incompatible factors

3. To obtain the codes of a factor variable, one uses as.numeric().
However, this function destroys the properties of the matrix, turning
it into a vector.
  Factors are very useful, but they are presently a mess for anything
except simple applications in lm/glm.
r-help 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-help-request@stat.math.ethz.ch