From wdunlap at tibco.com  Wed Oct  7 22:22:42 2015
From: wdunlap at tibco.com (William Dunlap)
Date: Wed, 7 Oct 2015 13:22:42 -0700
Subject: [Rd] read.table reads "i" as NA_complex_
Message-ID: <CAF8bMcbD=RST5NA1S5FhRj+3hV6UAAayn8pQs-pfmJkzjyvF-Q@mail.gmail.com>

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]]



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