Re: [R] read.table and NaN

2019-10-25 Thread Bert Gunter
--- > *From:* Bert Gunter > *Sent:* Thursday, October 24, 2019 10:39 > *To:* Sebastien Bihorel > *Cc:* r-help@r-project.org > *Subject:* Re: [R] read.table and NaN > > Not so. Read ?read.table carefully. You can use "NA" as a default. > Moreover, you

Re: [R] read.table and NaN

2019-10-25 Thread Sebastien Bihorel via R-help
nter Sent: Thursday, October 24, 2019 10:39 To: Sebastien Bihorel Cc: r-help@r-project.org Subject: Re: [R] read.table and NaN Not so. Read ?read.table carefully. You can use "NA" as a default. Moreover, you **specified** that you want NaN read as character, which means that any c

Re: [R] read.table and NaN

2019-10-24 Thread Bert Gunter
>> read.table call accordingly. I am working on a framework that is meant to >> process data files with unknown structure, so I have to think a bit more >> about that... >> ---------- >> *From:* Bert Gunter >> *Sent:* Thursday, October 24, 2019 00:08 >> *To:* Se

Re: [R] read.table and NaN

2019-10-24 Thread Bert Gunter
a framework that is meant to > process data files with unknown structure, so I have to think a bit more > about that... > -- > *From:* Bert Gunter > *Sent:* Thursday, October 24, 2019 00:08 > *To:* Sebastien Bihorel > *Cc:* r-help@r-project.org > *Subj

Re: [R] read.table and NaN

2019-10-24 Thread Sebastien Bihorel via R-help
Gunter Sent: Thursday, October 24, 2019 00:08 To: Sebastien Bihorel Cc: r-help@r-project.org Subject: Re: [R] read.table and NaN Like this? con <- textConnection(object = 'A,B\n1,NaN\nNA,2') > tmp <- read.table(con, header = TRUE, sep = ',', na.strings = &#

Re: [R] read.table and NaN

2019-10-23 Thread Bert Gunter
Like this? con <- textConnection(object = 'A,B\n1,NaN\nNA,2') > tmp <- read.table(con, header = TRUE, sep = ',', na.strings = '', stringsAsFactors = FALSE, + colClasses = c("numeric", "character")) > close.connection(con) > tmp A B 1 1 NaN 2 NA 2 > class(tmp[,1]) [1] "num

[R] read.table and NaN

2019-10-23 Thread Sebastien Bihorel via R-help
Hi, Is there a way to make read.table consider NaN as a string of characters rather than the internal NaN? Changing the na.strings argument does not seems to have any effect on how R interprets the NaN string (while is does not the the NA string) con <- textConnection(object = 'A,B\n1,NaN\nNA,