---
> *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
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
>> 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
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
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 =
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
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,
7 matches
Mail list logo