<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
Reproduced, thanks. Can't think why that is, but will fix. Please
file as a bug so it's not forgotten.<br>
<br>
In the meantime, setting the class manually for that column
(colClasses argument) works in this example :<br>
<br>
fread( paste0( strData, collapse="\n" ), integer64="character",
colClasses=list(numeric="b"))<br>
<br>
Is that workable for the full example? I've used that syntax for
colClasses so you can pass a vector of column names to be read as
numeric more easily, if need be.<br>
<br>
Matt<br>
<br>
<br>
On 03/05/14 02:08, Harish wrote:<br>
</div>
<blockquote
cite="mid:1399079322.73291.YahooMailNeo@web120206.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:12pt">I was trying to use
fread() to read data when I got the following error which made
no sense:<br style="" class="">
<br style="" class="">
<span class="" style="border-collapse: separate; color: rgb(248,
248, 248); font-family: 'Lucida Console'; font-size: 13px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 15px; orphans: 2;
text-align: -webkit-left; text-indent: 0px; text-transform:
none; white-space: pre-wrap; widows: 2; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; background-color: rgb(20, 20, 20)">
<pre tabindex="0" class="" style="font-family: 'Lucida Console'; font-size: 10pt
!important; outline-style: none; outline-width: initial; outline-color: initial; border-width: initial; border-color: initial; white-space: pre-wrap !important; word-break: break-all; -webkit-user-select: text; line-height: 1.2"><span class="" style="color: rgb(207, 106, 76)">In fread(paste0(strData, collapse = "\n"), integer64 = "character") :
Bumped column 2 to type character on data row 13, field contains '2464.77'. Coercing previously read values in this column from integer or numeric back to character which may not be lossless; e.g., if '00' and '000' occurred before they will now be just '0', and there may be inconsistencies with treatment of ',,' and ',NA,' too (if they occurred in this column before the bump). If this matters please rerun and set 'colClasses' to 'character' for this column. Please note that column type detection uses the first 5 rows, the middle 5 rows and the last 5 rows, so hopefully this message should be very rare. If reporting to datatable-help, please rerun and include the output from verbose=TRUE.</span></pre>
</span>because "2464.77" is a perfectly legitimate number and
there is no reason to coerce the column to character for that.<br
style="" class="">
<br style="" class="">
Here is how to reproduce it:<br style="" class="">
<br style="" class="">
dtT <- data.table( a = 1:72, b=0 )<br style="" class="">
dtT[ 13, b := 2464.77 ]<br style="" class="">
<br style="" class="">
strData <- capture.output( write.table( dtT,
row.names=FALSE, quote=FALSE, sep="\t" ) )<br style="" class="">
fread( paste0( strData, collapse="\n" ),
integer64="character" )<br style="" class="">
<br style="" class="">
<div style="" class="">Note that the following works okay
without the integer64="character" argument:</div>
<div style="" class=""> dtT <- data.table( a = 1:72, b=0 )<br
style="" class="">
dtT[ 13, b := 2464.77 ]<br style="" class="">
<br style="" class="">
strData <- capture.output( write.table( dtT,
row.names=FALSE, quote=FALSE, sep="\t" ) )<br style=""
class="">
fread( paste0( strData, collapse="\n" ) )</div>
<div style="" class=""><br>
</div>
<div style="" class="">I would appreciate if you could provide
some sort of a workaround for this. The reason I am using the
integer64="character" argument is that I have large numbers at
times which seems to be having issues once it is read as
integer64 -- and that might have nothing to do with data.table
but I have not had time to look into it. My work-around for
that issue was to read it as character, but I run into the
above issue.<br>
</div>
<div style="" class=""><br>
</div>
<div style="" class="">Thanks for your help.<br>
</div>
<div style="" class=""><br>
</div>
<div style="" class="">Regards,</div>
<div style="" class="">Harish</div>
<div style="" class=""><br>
</div>
<div style="" class=""><br style="" class="">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
datatable-help mailing list
<a class="moz-txt-link-abbreviated" href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a>
<a class="moz-txt-link-freetext" href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a></pre>
</blockquote>
<br>
</body>
</html>