[R] problem with levels in dataframes

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jul 2 11:39:29 CEST 2001


On Mon, 2 Jul 2001 tomsv193 at student.liu.se wrote:

> 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

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

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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



More information about the R-help mailing list