<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Right, thanks Frank. Sorry, I think fatigue is piling up here!<br>
    --Mel.<br>
    <br>
    <div class="moz-cite-prefix">On 8/4/2015 9:02 AM, Frank Erickson
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJd-hd=os4D8pw8ZriZhHcrxcktfh4SU08tFgX=1aGN0bAunMw@mail.gmail.com"
      type="cite">
      <div dir="ltr">.I was never an index by group. You'd have to make
        that more manually, like 1:.N</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Aug 4, 2015 at 8:54 AM, Bacou,
          Melanie <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:mel@mbacou.com" target="_blank">mel@mbacou.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Starting
            to wonder if something else is going on with my R install.
            Using the same CSV file, I'm not getting what I expect with
            `.I` (I would expect an index by group).<br>
            <br>
            ```<br>
            pcn08 <- fread("./data/PovCalServlet_15.08.03.csv")<br>
            <br>
            # and then grouping by 2 fields<br>
            pcn08[, test := .I, by=list(country, povLine)]<br>
            <br>
            pcn08$test<br>
            # [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18
            19 20 21 22 23 24 25 26 27<br>
            # [28] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
            46 47 48 49 50 51 52 53 54<br>
            # [55] 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
            73 74 75 76 77 78 79 80 81<br>
            # [82] 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98<br>
            <br>
            # but there are 86 groups<br>
            dim(pcn08[, .N, by=list(country, povLine)])<br>
            # [1] 86  3<br>
            <br>
            ```
            <div class="HOEnZb">
              <div class="h5"><br>
                <br>
                On 8/4/2015 8:06 AM, Bacou, Melanie wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  In case that happens to others. Seems related to R
                  global `digits` options, maybe something changed in
                  R.3.2.1.<br>
                  --Mel.<br>
                  <br>
                  ```<br>
                  options(digits=3)<br>
                  1000-0.5<br>
                  # [1] 1000<br>
                  options(digits=5)<br>
                  1000-0.5<br>
                  <br>
                  # [1] 999.5<br>
                  <br>
                  ```<br>
                  <br>
                  On 8/4/2015 7:54 AM, Bacou, Melanie wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    Hi,<br>
                    Thx, I see I have another problem, not related to
                    data.table (sorry). R seems to truncate numbers in
                    the console. Not sure what's going on.<br>
                    <br>
                    --Mel.<br>
                    <br>
                    ```{r}<br>
                    > 1-0.5<br>
                    [1] 0.5<br>
                    > 2008-0.05<br>
                    [1] 2008<br>
                    > 45-0.5<br>
                    [1] 44.5<br>
                    > 100-0.5<br>
                    [1] 99.5<br>
                    > 1000-0.5<br>
                    [1] 1000<br>
                    > 10000-0.5<br>
                    [1] 10000<br>
                    ```<br>
                    <br>
                    On 8/4/2015 7:16 AM, nachti wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      Hi,<br>
                      copying your code, everything works as expected
                      for me.<br>
                      Maybe you just referenced to a wrong object
                      (pcn08)?<br>
                      <br>
                      ```<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        library(data.table)<br>
                      </blockquote>
                      data.table 1.9.4  For help type: ?data.table<br>
                      *** NB: by=.EACHI is now explicit. See README to
                      restore previous behaviour.<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        pcn <- fread("PovCalServlet_15.08.03.csv")<br>
                      </blockquote>
                      sapply(pcn, class)<br>
                      pcn <- fread("PovCalServlet_15.08.03.csv")<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        sapply(pcn, class)<br>
                      </blockquote>
                           country     povLine        mean         hcr
                      gap sev<br>
                      "character"   "numeric"   "numeric"   "numeric" 
                       "numeric" "numeric"<br>
                             watts        popM     yearNum<br>
                         "numeric"   "numeric"   "numeric"<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        pcn08$yearNum<br>
                      </blockquote>
                      Error: object 'pcn08' not found<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        pcn$yearNum<br>
                      </blockquote>
                        [1] 2008.50 2011.50 2009.25 2009.00 2006.00
                      2007.50 2007.00 2008.00 2011.00<br>
                      [10] 2004.00 2005.50 2011.00 2008.00 2010.50
                      2005.00 2003.00 2005.50 2008.00<br>
                      [19] 2007.00 2012.00 2002.00 2005.40 2010.00
                      2007.00 2010.00 2010.23 2010.00<br>
                      [28] 2008.00 2008.00 2012.00 2006.00 2008.64
                      2009.50 2011.00 2009.83 2010.83<br>
                      [37] 2010.00 2011.00 2006.50 2011.00 2010.67
                      2009.00 2009.50 2011.80 2011.00<br>
                      [46] 2008.00 2012.50 2009.30 2010.00 2008.50
                      2011.50 2009.25 2009.00 2006.00<br>
                      [55] 2007.50 2007.00 2008.00 2011.00 2004.00
                      2005.50 2011.00 2008.00 2010.50<br>
                      [64] 2005.00 2003.00 2005.50 2008.00 2007.00
                      2012.00 2002.00 2005.40 2010.00<br>
                      [73] 2007.00 2010.00 2010.23 2010.00 2008.00
                      2008.00 2012.00 2006.00 2008.64<br>
                      [82] 2009.50 2011.00 2009.83 2010.83 2010.00
                      2011.00 2006.50 2011.00 2010.67<br>
                      [91] 2009.00 2009.50 2011.80 2011.00 2008.00
                      2012.50 2009.30 2010.00<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        sessionInfo()<br>
                      </blockquote>
                      R version 3.2.1 (2015-06-18)<br>
                      Platform: x86_64-suse-linux-gnu (64-bit)<br>
                      Running under: openSUSE 13.1 (Bottle) (x86_64)<br>
                      <br>
                      locale:<br>
                        [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C<br>
                        [3] LC_TIME=en_US.UTF-8       
                      LC_COLLATE=en_US.UTF-8<br>
                        [5] LC_MONETARY=en_US.UTF-8   
                      LC_MESSAGES=en_US.UTF-8<br>
                        [7] LC_PAPER=en_US.UTF-8       LC_NAME=C<br>
                        [9] LC_ADDRESS=C               LC_TELEPHONE=C<br>
                      [11] LC_MEASUREMENT=en_US.UTF-8
                      LC_IDENTIFICATION=C<br>
                      <br>
                      attached base packages:<br>
                      [1] stats     graphics  grDevices utils   
                       datasets  methods base<br>
                      <br>
                      other attached packages:<br>
                      [1] data.table_1.9.4<br>
                      <br>
                      loaded via a namespace (and not attached):<br>
                      [1] compiler_3.2.1 magrittr_1.5   plyr_1.8.3   
                       tools_3.2.1<br>
                      reshape2_1.4.1<br>
                      [6] Rcpp_0.11.6    stringi_0.5-5  stringr_1.0.0 
                      chron_2.3-4<br>
                      ```<br>
                      <br>
                      ~g<br>
                      <br>
                      <br>
                      <br>
                      -- <br>
                      View this message in context: <a
                        moz-do-not-send="true"
href="http://r.789695.n4.nabble.com/Apparent-loss-of-decimals-when-reading-a-numeric-column-with-fread-tp4710722p4710727.html"
                        rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://r.789695.n4.nabble.com/Apparent-loss-of-decimals-when-reading-a-numeric-column-with-fread-tp4710722p4710727.html">http://r.789695.n4.nabble.com/Apparent-loss-of-decimals-when-reading-a-numeric-column-with-fread-tp4710722p4710727.html</a></a><br>
                      Sent from the datatable-help mailing list archive
                      at Nabble.com.<br>
                      _______________________________________________<br>
                      datatable-help mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:datatable-help@lists.r-forge.r-project.org"
                        target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
                      <a moz-do-not-send="true"
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help"
                        rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a>
                      <br>
                    </blockquote>
                    <br>
                  </blockquote>
                  <br>
                </blockquote>
                <br>
                _______________________________________________<br>
                datatable-help mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:datatable-help@lists.r-forge.r-project.org"
                  target="_blank">datatable-help@lists.r-forge.r-project.org</a><br>
                <a moz-do-not-send="true"
href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help"
                  rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>