Skip to content

problem with levels in dataframes

2 messages · tomsv193@student.liu.se, Brian Ripley

#
Hi!

I am reading from one data.frame and writing to antoher (that is: data-
transfer...). Sometimes the value transferred is NA. I use the 
following line (i and j are well defined!):

protocol$n.adjustments[i]<-protocol.adjustment$n.adjustments[j]

I recieve this warning:
invalid factor level, NAs generated in: [<-.factor(*tmp*, i, value = 0)

What does this mean? The data.frames are read from files (and these 
files are saved with write.table(...,quote=FALSE). 

/Tomas Svensson
WinNT, R 1.2.3



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Mon, 2 Jul 2001 tomsv193 at student.liu.se wrote:

            
It means protocol.adjustment$n.adjustments[j] is not a level existing in
the factor protocol$n.adjustments, hence `invalid factor level'.

You'll need to look at the details for yourself.

Factors are designed to a fixed set of levels: you can't add to the levels
by assignment like this.

Brian