[R] write.table problem

Hector L. Ayala-del-Rio ayalahec at msu.edu
Thu Apr 24 17:00:18 CEST 2003


THANKS!!!!  That is what I needed.

Hector

On Thursday, April 24, 2003, at 10:19  AM, Prof Brian Ripley wrote:

> On Thu, 24 Apr 2003, Hector L. Ayala-del-Rio wrote:
>
>> Dear R helpers,
>>    I have been using the loadings function from the multiv library 
>> and I
>
> Looks like loadings() from the *mva* package to me, or more precisely
> the result of the print method for loadings.
>
>> get the typical output (see below).  When I try to export these 
>> results
>> to a file using a write.table() I get the following error message
>> "Error in as.data.frame.default(x[[i]], optional = TRUE) : can't 
>> coerce
>> loadings into a data.frame"  Any idea why write.table is doing that 
>> and
>> any possible solutions??
>
> ?write.table says
>
>      `write.table' prints its required argument `x' (after converting
>      it to a data frame if it is not one already) to `file'.
>
> There is no in-built way to convert a `loadings' object to a data 
> frame,
> but as it is a matrix (see ?princomp), unclass(loadings(foo)) will 
> work.
>
>
>>> write.table(loadings(M2.princomp.corr))
>                  ^unclass(                 ^)
>
> Note that you do get just the loadings, not the full output from
> print.loadings.
>
>
> -- 
> 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
>
>


Héctor L. Ayala-del-Río, Ph.D.
Center for Microbial Ecology &
Center for Genomic and Evolutionary Studies
on Microbial Life at Low Temperatures
Michigan State University
545 Plant & Soil Sciences Building
East Lansing, MI 48824-1325
Phone: 517-353-9021
Fax: 517-353-2917



More information about the R-help mailing list