<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">On 08/08/13 05:11, Eduard Antonyan
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHZcBOqZeutPMJj-QMcTogNEoQ3ueeXtT=YUp1BgwbRdG-EUQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>This seems like a pretty natural interpretation of
                list->data.table to me, although it would be nice to
                maybe get a warning I think here:<br>
                <br>
              </div>
                  X = list(a = list(1,2), b = list(1,2,3))<br>
              <br>
            </div>
                as.data.table(X)</div>
        </div>
      </div>
    </blockquote>
    Good point,  that should be recycle-remainder warning.<br>
    <blockquote
cite="mid:CAHZcBOqZeutPMJj-QMcTogNEoQ3ueeXtT=YUp1BgwbRdG-EUQg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          especially since this simply refuses to do anything:<br>
          <br>
              data.table(a = c(1,2), b = c(1,2,3))<br>
        </div>
      </div>
    </blockquote>
    Ah but that's for consistency with data.frame ;)<br>
    <br>
    > data.frame(1:2,1:3)<br>
    Error in data.frame(1:2, 1:3) : <br>
      arguments imply differing number of rows: 2, 3<br>
    > <br>
    <br>
    Happy to recycle and change both above to recyle-remainder
    warning.   If there's no recycle remainder then no warning, right?  
    Repeating singletons is a common use case I wouldn't want a warning
    about, for example.   Could you file a request please?<br>
    <blockquote
cite="mid:CAHZcBOqZeutPMJj-QMcTogNEoQ3ueeXtT=YUp1BgwbRdG-EUQg@mail.gmail.com"
      type="cite">
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Wed, Aug 7, 2013 at 10:30 PM,
          Ricardo Saporta <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:saporta@scarletmail.rutgers.edu"
              target="_blank">saporta@scarletmail.rutgers.edu</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hey Frank, 
              <div><br>
              </div>
              <div>Thanks for pointing out that SO link, I had missed
                it. </div>
              <div><br>
              </div>
              <div>All, </div>
              <div><br>
              </div>
              <div>I'm curious as to which used cases this functionality
                would be used in (used for?)</div>
              <div><br>
              </div>
              <div>thanks, </div>
              <div>Rick </div>
              <div>
                <div class="h5">
                  <div><br>
                  </div>
                  <div class="gmail_extra">
                    <br>
                    <br>
                    <div class="gmail_quote">On Wed, Aug 7, 2013 at 8:14
                      PM, Frank Erickson <span dir="ltr"><<a
                          moz-do-not-send="true"
                          href="mailto:FErickson@psu.edu"
                          target="_blank">FErickson@psu.edu</a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        <div>Hi Rick,</div>
                        <div><br>
                        </div>
                        <div>I guess it's intentional: Matthew saw this
                          SO question (since he edited one of the
                          answers): <a moz-do-not-send="true"
href="http://stackoverflow.com/questions/9547518/creating-a-data-frame-where-a-column-is-a-list"
                            target="_blank">http://stackoverflow.com/questions/9547518/creating-a-data-frame-where-a-column-is-a-list</a></div>
                        <div><br>
                        </div>
                        <div>Some musings: Of course, to reproduce
                          as.data.frame-like behavior, you can un-nest
                          the list, so both functions treat it the same
                          way.</div>
                        <div><br>
                        </div>
                        <blockquote style="margin:0 0 0
                          40px;border:none;padding:0px">
                          <div>Z <- unlist(Y,recursive=FALSE)</div>
                          <div><br>
                          </div>
                          <div>
                            <div>identical(as.data.table(Z),as.data.table(as.data.frame(Z)))
                              # TRUE</div>
                          </div>
                          <div>
                            <div># or, equivalently (?)</div>
                          </div>
                          <div>
                            <div>identical(do.call(data.table,Z),data.table(do.call(data.frame,Z)))
                              # TRUE</div>
                          </div>
                        </blockquote>
                        <div><br>
                        </div>
                        <div>On the other hand, going back the other
                          direction (getting data.table-like behavior
                          when data.frame's is the default) is more
                          awkward, as seen in that SO question (where
                          they mention protecting each sublist with the
                          I() function). Besides, I'm with @flodel, who
                          asked the SO question, in expecting
                          data.table's behavior: one top-level item in
                          the list mapping to one column in the
                          result...</div>
                        <div><br>
                        </div>
                        <div>--Frank</div>
                        <div><br>
                          <div class="gmail_quote">
                            <div>
                              <div>On Wed, Aug 7, 2013 at 4:56 PM,
                                Ricardo Saporta <span dir="ltr"><<a
                                    moz-do-not-send="true"
                                    href="mailto:saporta@scarletmail.rutgers.edu"
                                    target="_blank">saporta@scarletmail.rutgers.edu</a>></span>
                                wrote:<br>
                              </div>
                            </div>
                            <blockquote class="gmail_quote"
                              style="margin:0 0 0 .8ex;border-left:1px
                              #ccc solid;padding-left:1ex">
                              <div>
                                <div>
                                  <div dir="ltr">
                                    <div>Hi all, <br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>Note the following discrepancy
                                      in structure between as.data.frame
                                      & as.data.table when called on
                                      a nested list.</div>
                                    <div>as.data.frame converts the
                                      sublist into individual columns
                                      whereas as.data.table stacks them
                                      into a single column and creates
                                      additional rows. </div>
                                    <div><br>
                                    </div>
                                    <div>Is this intentional? </div>
                                    <div>-Rick</div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>
                                      <div>as.data.frame(X)</div>
                                      <div>#        start       type    
                                         end data.editDist data.second</div>
                                      <div># 1 start_node is_similar
                                        end_node             1
                                         HelloWorld</div>
                                      <div><br>
                                      </div>
                                      <div>as.data.table(X)</div>
                                      <div>#         start       type  
                                           end       data</div>
                                      <div># 1: start_node is_similar
                                        end_node          1</div>
                                      <div># 2: start_node is_similar
                                        end_node HelloWorld</div>
                                    </div>
                                    <div>
                                      <br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div>### Copy+Paste'able Below ###</div>
                                    <div><br>
                                    </div>
                                    <div># Example 1:</div>
                                    <div>X <-  structure(list(start =
                                      "start_node", type = "is_similar",
                                      end = "end_node", </div>
                                    <div>    data =
                                      structure(list(editDist = 1,
                                      second = "HelloWorld"), .Names =
                                      c("editDist", </div>
                                    <div>    "second"))), .Names =
                                      c("start", "type", "end", "data"))</div>
                                    <div><br>
                                    </div>
                                    <div>as.data.frame(X)<br>
                                    </div>
                                    <div>as.data.table(X)</div>
                                    <div><br>
                                    </div>
                                    <div>as.data.table(as.data.frame(X))</div>
                                    <div><br>
                                    </div>
                                    <div><br>
                                    </div>
                                    <div># Example 2, with more
                                      elements:</div>
                                    <div>Y <- structure(list(start =
                                      c("start_node", "start_node"),
                                      type = c("is_similar",
                                      "is_similar"), end = c("end_node",
                                      "end_node"), data =
                                      structure(list(editDist = c(1, 1),
                                      second = c("HelloWorld",
                                      "HelloWorld")), .Names =
                                      c("editDist", "second"))), .Names
                                      = c("start", "type", "end",
                                      "data"))</div>
                                    <div><br>
                                    </div>
                                    <div>as.data.frame(Y)</div>
                                    <div>as.data.table(Y)</div>
                                    <div><br>
                                    </div>
                                  </div>
                                  <br>
                                </div>
                              </div>
_______________________________________________<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"
                                target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
                            </blockquote>
                          </div>
                          <br>
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            datatable-help mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:datatable-help@lists.r-forge.r-project.org">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"
              target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
          </blockquote>
        </div>
        <br>
      </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>