<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><p id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;">Thank you, Arun!</p> <br><div id="bloop_sign_1369160115122537216"><span style="font-family:helvetica,arial;font-size:13px"></span><div style="font-family: Helvetica; line-height: normal; ">-- </div><div style="font-family: Helvetica; line-height: normal; "><span style="font-family: arial; font-size: small; ">Alexandre Sieira</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">CISA, CISSP, ISO 27001 Lead Auditor</span><br style="font-family: arial; font-size: small; "><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">"The truth is rarely pure and never simple."</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">Oscar Wilde, The Importance of Being Earnest, 1895, Act I</span></div></div><p style="color:#A0A0A8;">On 21 de maio de 2013 at 15:14:39, Arunkumar Srinivasan (aragorn168b@gmail.com) wrote:</p> <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div>
                <div>
                    You can download 1.8.9 from r-forge and use it. If you're much concerned, you can use devtools and install 1.8.9 in dev mode as follows:
                </div><div><br></div><div>>require(devtools)</div><div>>dev_mode(TRUE)</div><div>d> install.packages("data.table", repos="<a href="http://R-Forge.R-project.org" style="color: rgb(0, 106, 227); ">http://R-Forge.R-project.org</a>", type="source")</div><div>d> require(data.table)</div><div>d> # do whatever calculations you want</div><div>d> dev_mode(FALSE)</div><div>> # returns to normal session</div>
                <div><div><br></div><div>Arun</div><div><br></div></div>
                  
                <p style="color: #A0A0A8;">On Tuesday, May 21, 2013 at 8:11 PM, Alexandre Sieira wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><p style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;">Thank you, I'll wait for the next release then. </p><p style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;"><br></p><p style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;">It's do.call("rbind", …) till then, I presume. :)</p> <br><div><span style="font-family:helvetica,arial;font-size:13px"></span><div style="font-family: Helvetica; line-height: normal; ">-- </div><div style="font-family: Helvetica; line-height: normal; "><span style="font-family: arial; font-size: small; ">Alexandre Sieira</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">CISA, CISSP, ISO 27001 Lead Auditor</span><br style="font-family: arial; font-size: small; "><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">"The truth is rarely pure and never simple."</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">Oscar Wilde, The Importance of Being Earnest, 1895, Act I</span></div></div><p style="color:#A0A0A8;">On 21 de maio de 2013 at 15:09:00, Arunkumar Srinivasan (<a href="mailto:aragorn168b@gmail.com">aragorn168b@gmail.com</a>) wrote:</p><blockquote type="cite"><div><span><div>
                <div>
                    This was already addressed here:
                </div><div><a href="http://stackoverflow.com/questions/15933846/rbindlist-two-data-tables-where-one-has-factor-and-other-has-character-type-for">http://stackoverflow.com/questions/15933846/rbindlist-two-data-tables-where-one-has-factor-and-other-has-character-type-for</a></div><div><br></div><div>And was known to be a bug filed here:</div><div><a href="https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2650&group_id=240&atid=975">https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2650&group_id=240&atid=975</a></div><div><br></div><div>Which has been fixed in the current development version 1.8.9. (</div><table style="border-collapse: collapse; border-spacing: 0px; font-size: 14px; margin-bottom: 1em; color: rgb(68, 68, 68); font-family: verdana, sans-serif; line-height: 16px; text-align: left; "><tbody><tr style="background-color: white;"><td style="margin: 0px; padding: 3px; border: none; ">Fixed by commit 879 in v1.8.9</td></tr></tbody></table>
                <div><div>Hope this helps,</div><div>Arun</div><div><br></div></div>
                    
                <p style="color: #A0A0A8;">On Tuesday, May 21, 2013 at 8:06 PM, Alexandre Sieira wrote:</p><blockquote type="cite"><div>
                    <span><div><div><p style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;">I think I found an unexpected behavior with rbindlist when columns are factors:</p><p style="font-family:Helvetica,Arial;font-size:13px; margin: 0px; line-height: auto;"><br></p><p style="margin: 0px; "><font face="Courier New">> dt1 = data.table(a=as.factor(c("a", "a", "a")))</font></p><p style="margin: 0px; "></p><p style="margin: 0px; "><font face="Courier New">> dt1</font></p><p style="margin: 0px; "><font face="Courier New">   a</font></p><p style="margin: 0px; "><font face="Courier New">1: a</font></p><p style="margin: 0px; "><font face="Courier New">2: a</font></p><p style="margin: 0px; "><font face="Courier New">3: a</font></p><p style="margin: 0px; "><font face="Courier New">> str(dt1)</font></p><p style="margin: 0px; "><font face="Courier New">Classes ‘data.table’ and 'data.frame':<span style="white-space:pre">  </span>3 obs. of  1 variable:</font></p><p style="margin: 0px; "><font face="Courier New"> $ a: Factor w/ 1 level "a": 1 1 1</font></p><p style="margin: 0px; "><font face="Courier New"> - attr(*, ".internal.selfref")=<externalptr> </font></p><p style="margin: 0px; "><font face="Courier New">> dt2 = data.table(a=as.factor(c("b", "b", "b")))</font></p><p style="margin: 0px; "><font face="Courier New">> dt2</font></p><p style="margin: 0px; "><font face="Courier New">   a</font></p><p style="margin: 0px; "><font face="Courier New">1: b</font></p><p style="margin: 0px; "><font face="Courier New">2: b</font></p><p style="margin: 0px; "><font face="Courier New">3: b</font></p><p style="margin: 0px; "><font face="Courier New">> str(dt2)</font></p><p style="margin: 0px; "><font face="Courier New">Classes ‘data.table’ and 'data.frame':<span style="white-space:pre">    </span>3 obs. of  1 variable:</font></p><p style="margin: 0px; "><font face="Courier New"> $ a: Factor w/ 1 level "b": 1 1 1</font></p><p style="margin: 0px; "><font face="Courier New"> - attr(*, ".internal.selfref")=<externalptr> </font></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; ">If I rbind them, I get the expected value - a table with 6 rows, 3 of which have value "a" and 3 with value "b":</p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="margin: 0px; "></p><p style="margin: 0px; "><font face="Courier New">> rbind(dt1, dt2)</font></p><p style="margin: 0px; "><font face="Courier New">   a</font></p><p style="margin: 0px; "><font face="Courier New">1: a</font></p><p style="margin: 0px; "><font face="Courier New">2: a</font></p><p style="margin: 0px; "><font face="Courier New">3: a</font></p><p style="margin: 0px; "><font face="Courier New">4: b</font></p><p style="margin: 0px; "><font face="Courier New">5: b</font></p><p style="margin: 0px; "><font face="Courier New">6: b</font></p><p></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; ">So if I do rbindlist(list(dt1, dt2)), I would expect to get the exact same result, only faster. Unfortunately, that is not the case:</p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="margin: 0px; "></p><p style="margin: 0px; "><font face="Courier New">> rbindlist(list(dt1, dt2))</font></p><p style="margin: 0px; "><font face="Courier New">   a</font></p><p style="margin: 0px; "><font face="Courier New">1: a</font></p><p style="margin: 0px; "><font face="Courier New">2: a</font></p><p style="margin: 0px; "><font face="Courier New">3: a</font></p><p style="margin: 0px; "><font face="Courier New">4: a</font></p><p style="margin: 0px; "><font face="Courier New">5: a</font></p><p style="margin: 0px; "><font face="Courier New">6: a</font></p><p style="margin: 0px; "></p><p style="margin: 0px; "><font face="Courier New">> str(rbindlist(list(dt1, dt2)))</font></p><p style="margin: 0px; "><font face="Courier New">Classes ‘data.table’ and 'data.frame':<span style="white-space:pre">    </span>6 obs. of  1 variable:</font></p><p style="margin: 0px; "><font face="Courier New"> $ a: Factor w/ 1 level "a": 1 1 1 1 1 1</font></p><p style="margin: 0px; "><font face="Courier New"> - attr(*, ".internal.selfref")=<externalptr> </font></p><p></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; ">This was executed with R 3.0.1 and data.table 1.8.8 on a Mac OS X 10.8.3.</p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; "><br></p><p style="font-family: Helvetica, Arial; font-size: 13px; margin: 0px; ">Is this expected behavior? Am I missing something?</p><p></p><p></p><br><div><span style="font-family:helvetica,arial;font-size:13px"></span><div style="font-family: Helvetica; line-height: normal; ">-- </div><div style="font-family: Helvetica; line-height: normal; "><span style="font-family: arial; font-size: small; ">Alexandre Sieira</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">CISA, CISSP, ISO 27001 Lead Auditor</span><br style="font-family: arial; font-size: small; "><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">"The truth is rarely pure and never simple."</span><br style="font-family: arial; font-size: small; "><span style="font-family: arial; font-size: small; ">Oscar Wilde, The Importance of Being Earnest, 1895, Act I</span></div></div></div><div><div>_______________________________________________</div><div>datatable-help mailing list</div><div><a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a></div><div><a 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></div></div></div></span>
                    
                    
                    
                    
                </div></blockquote><div>
                    <br>
                </div>
            </div></span></div></blockquote></div></div></span>
                  
                  
                  
                  
                </blockquote>
                  
                <div>
                    <br>
                </div>
            </div></span></blockquote></body></html>