[Rd] na.omit and class conversion (PR#6967)

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jun 10 19:57:55 CEST 2004


We need a reproducible example.  Please read the FAQ on BUGS and give an 
example and a clear example of why you are sure it is an error and not a 
misunderstanding.

On Thu, 10 Jun 2004 mark0060 at tc.umn.edu wrote:

> Full_Name: Kristian E. Markon
> Version: 1.90
> OS: WinXP
> Submission from: (NULL) (24.26.179.28)
> 
> 
> I have been having problems with na.omit, and am not sure if it is a bug, or new
> behavior.
> 
> Basically, I observe exactly the same behavior as described in the bug
> Language-fixed/522, but it occurs with classes other than matrices, including
> data.frames. I am not sure how to reproduce it, as it sometimes occurs with
> matrices, and sometimes not, and sometimes with data.frames and sometimes not.
> It does occur repeatedly, however. 
> 
> I have observed another issue that may be related: It sometimes seems that
> classes are not being converted. 
> 
> For example, if I do a factor analysis and save the loading matrix in an
> object--e.g.,
> 
> temp.fa = factanal(covmat=x.cor, factors=2)
> 
> temp.load = temp.fa$load
> 
> I will sometimes get error messages that such and such is not possible with
> loading matrices. 
> 
> For example, if I try to put the loadings in a list, and then convert the list
> to a data.frame, as in
> 
> as.data.frame(list(items=names, load=temp.load)), I get an error stating that
> loadings cannot be converted to data.frames. 

True, and why do you think that is an error?

> This error persists if I convert the loading matrix to a matrix class--e.g.,
> 
> as.data.frame(list(items=names, load=as.matrix(temp.load)))
> 
> However, if I create a matrix, and assign the loadings to this matrix--e.g.,
> 
> load.mat = matrix(nrow=35,ncol=2)
> 
> load.mat[1:35,1:2] = as.matrix(temp.load)
> 
> then the following command 
> 
> as.data.frame(list(items=names, load=temp.load))
> 
> works as expected. 
> 
> The reason why I suspect the na.omit problem may be related is that I seem to
> observe na.omit problems more often when dealing with objects that have been
> converted from one class to another.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list