On Thu, 16 Jan 2003, Cyril Humbert wrote:

> write.table() seems to write "numeric" data as "complex"
> if one column of the data.frame is "complex". Is it a
> way to avoid this ?

Comment the line x <- as.matrix(x) in write.table.

>
> For example:
>
> > df <- data.frame(x=c(1,2), z=c(1i+1, 2i+2))
> > df
>         x    z
>       1 1 1+1i
>       2 2 2+2i
>
> > mode(df$x)
>       [1] "numeric"
>
> > write.table(df, file="aa.dat")
> > df<-read.table("aa.dat", header=TRUE)
> > df
>            x    z
>       1 1+0i 1+1i
>       2 2+0i 2+2i
>
> > mode(df$x)
>       [1] "complex"
>
> > version
>       platform i386-pc-linux-gnu
>       major    1
>       minor    6.2
>
>
> Thanks
>
> --
> Cyril
>
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
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

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to