<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;">It works perfectly for me with the syntax Eduard mentioned. Thank you very much for the quick response!</p> <br><div id="bloop_sign_1368803460226931968"><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 17 de maio de 2013 at 12:02:50, 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>
                    Eduard, are we discussing the same thing again :)? Wasn't this somehow your question as well.. the discrepancy between:
                </div><div><br></div><div>dt[, a] and dt[, "a", with=FALSE]. </div><div><br></div><div>There should be a drop=TRUE/FALSE option (as in the case of data.frame) that should be used when you use `with=FALSE`. Until then, the default option seems to be drop=FALSE, which results in a data.table.</div><div><br></div><div>Alexandre, as of now, it could be done as Eduard points out.</div>
                <div><div><br></div><div>Arun</div><div><br></div></div>
                  
                <p style="color: #A0A0A8;">On Friday, May 17, 2013 at 4:59 PM, Eduard Antonyan wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div><div dir="ltr">Use dt[[colname]], but this seems like a bug to me - I would've thought that dt[, a] and dt[, "a", with = F] should return the exact same thing.</div><div><br><br><div>
On Fri, May 17, 2013 at 9:42 AM, Alexandre Sieira <span dir="ltr"><<a href="mailto:alexandre.sieira@gmail.com" target="_blank">alexandre.sieira@gmail.com</a>></span> wrote:<br><blockquote type="cite"><div>
<div style="word-wrap:break-word"><p style="font-family:Helvetica,Arial;font-size:13px;margin:0px;line-height:auto">Sorry if this is a basic question.</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"><span style="font-family:sans-serif;line-height:normal">I'm using R 3.0.0 and data.table 1.8.8.</span><span style="font-family:sans-serif;line-height:normal"> </span>The documentation for 'j' states that "<span style="font-family:sans-serif;line-height:normal">A single column or single expression returns that type, usually a vector."</span></p>
<p style="font-family:Helvetica,Arial;font-size:13px;margin:0px;line-height:auto"><span style="font-family:sans-serif;line-height:normal"><br></span></p><p style="font-family:Helvetica,Arial;font-size:13px;margin:0px;line-height:auto">
<span style="font-family:sans-serif;line-height:normal">I am able to obtain this behavior if I know the column name in advance:</span></p><p style="font-family:Helvetica,Arial;font-size:13px;margin:0px;line-height:auto"><span style="font-family:sans-serif;line-height:normal"><br>
</span></p><p style="margin:0px"></p><p style="margin:0px"><font face="Courier New">> dt = data.table(a=c(1, 2, 3), b=c(4, 5, 6))</font></p><p style="margin:0px"><font face="Courier New">> dt</font></p><p style="margin:0px">
<font face="Courier New">   a b</font></p><p style="margin:0px"><font face="Courier New">1: 1 4</font></p><p style="margin:0px"><font face="Courier New">2: 2 5</font></p><p style="margin:0px"><font face="Courier New">3: 3 6</font></p>
<p style="margin:0px"><font face="Courier New">> str(dt[,a])</font></p><p style="margin:0px"><font face="Courier New"> num [1:3] 1 2 3</font></p><p></p><div><div><div>  </div></div></div><div><br></div><div>However, if I don't, no such luck:</div>
<div><br></div><div><div><font face="Courier New">> colname="a"</font></div><div><font face="Courier New">> str(dt[,colname,with=F])</font></div><div><font face="Courier New">Classes ‘data.table’ and 'data.frame':<span style="white-space:pre-wrap">  </span>3 obs. of  1 variable:</font></div>
<div><font face="Courier New"> $ a: num  1 2 3</font></div><div><font face="Courier New"> - attr(*, ".internal.selfref")=<externalptr> </font></div></div><div><br></div><div>If there a way to extract an entire column as a vector if I have the column name as a character scalar?</div>
<div><br></div><div>Thank you!</div><span><font color="#888888"><div><br></div><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></font></span></div><br>_______________________________________________<br>
datatable-help mailing list<br>
<a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br></div></blockquote></div><br></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>
                  
                  
                  
                  
                </blockquote>
                  
                <div>
                    <br>
                </div>
            </div></span></blockquote></body></html>