Re: [Rd] read.table reads "i" as NA_complex_

2015-10-07 Thread William Dunlap
Thank you both!

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Oct 7, 2015 at 1:44 PM, peter dalgaard  wrote:

> This is fixed/changed in r-devel:
>
> > str(type.convert("i"))
>  Factor w/ 1 level "i": 1
>
> It was reported on July 18 as PR#16473, if you care.
>
> (Funny how an obscure issue goes unnoticed for a decade, then pops up
> twice independently within a few months. A property of the Poisson process,
> I suppose.)
>
>
> > On 07 Oct 2015, at 22:22 , William Dunlap  wrote:
> >
> > I just noticed that read.table() and type.convert() interpret the string
> "i"
> > as a missing value of type complex.
> >> str(read.table(text=c("i\ni\ni\ni\n")))
> >   'data.frame':   4 obs. of  1 variable:
> >$ V1: cplx  NA NA NA ...
> >> str(type.convert("i"))
> >cplx NA
> >
> > If there are other strings in the column it makes the column character so
> > most people will not notice
> >> str(read.table(text=c("i\nii\niii\niv\n")))
> >   'data.frame':   4 obs. of  1 variable:
> >$ V1: Factor w/ 4 levels "i","ii","iii",..: 1 2 3 4
> >
> > Is this intended?  It surprised me.
> >
> > Bill Dunlap
> > TIBCO Software
> > wdunlap tibco.com
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-devel@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>
>
>
>
>
>
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] read.table reads "i" as NA_complex_

2015-10-07 Thread Prof Brian Ripley

On 07/10/2015 21:22, William Dunlap wrote:

I just noticed that read.table() and type.convert() interpret the string "i"
as a missing value of type complex.
> str(read.table(text=c("i\ni\ni\ni\n")))
'data.frame':   4 obs. of  1 variable:
 $ V1: cplx  NA NA NA ...
> str(type.convert("i"))
 cplx NA

If there are other strings in the column it makes the column character so
most people will not notice
> str(read.table(text=c("i\nii\niii\niv\n")))
'data.frame':   4 obs. of  1 variable:
 $ V1: Factor w/ 4 levels "i","ii","iii",..: 1 2 3 4

Is this intended?  It surprised me.


It was intended (that input is ambiguous), but it is being changed  
from the NEWS file for R-devel:


• type.convert("i") now returns a factor instead of a complex value
  with zero real part and missing imaginary part.

--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] read.table reads "i" as NA_complex_

2015-10-07 Thread William Dunlap
I just noticed that read.table() and type.convert() interpret the string "i"
as a missing value of type complex.
   > str(read.table(text=c("i\ni\ni\ni\n")))
   'data.frame':   4 obs. of  1 variable:
$ V1: cplx  NA NA NA ...
   > str(type.convert("i"))
cplx NA

If there are other strings in the column it makes the column character so
most people will not notice
   > str(read.table(text=c("i\nii\niii\niv\n")))
   'data.frame':   4 obs. of  1 variable:
$ V1: Factor w/ 4 levels "i","ii","iii",..: 1 2 3 4

Is this intended?  It surprised me.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] read.table reads "i" as NA_complex_

2015-10-07 Thread peter dalgaard
This is fixed/changed in r-devel:

> str(type.convert("i"))
 Factor w/ 1 level "i": 1

It was reported on July 18 as PR#16473, if you care.

(Funny how an obscure issue goes unnoticed for a decade, then pops up twice 
independently within a few months. A property of the Poisson process, I 
suppose.)


> On 07 Oct 2015, at 22:22 , William Dunlap  wrote:
> 
> I just noticed that read.table() and type.convert() interpret the string "i"
> as a missing value of type complex.
>> str(read.table(text=c("i\ni\ni\ni\n")))
>   'data.frame':   4 obs. of  1 variable:
>$ V1: cplx  NA NA NA ...
>> str(type.convert("i"))
>cplx NA
> 
> If there are other strings in the column it makes the column character so
> most people will not notice
>> str(read.table(text=c("i\nii\niii\niv\n")))
>   'data.frame':   4 obs. of  1 variable:
>$ V1: Factor w/ 4 levels "i","ii","iii",..: 1 2 3 4
> 
> Is this intended?  It surprised me.
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel