Something like expand.grid on a list of lists

前端 未结 3 917
花落未央
花落未央 2021-02-13 04:16

I have three text documents stored as a list of lists called \"dlist\":

dlist <- structure(list(name = c(\"a\", \"b\", \"c\"), text = list(c(\"the\", \"quick\         


        
3条回答
  •  迷失自我
    2021-02-13 04:37

    Another solution, maybe more generalizable:

    do.call(rbind, do.call(mapply, c(dlist, FUN = data.frame, SIMPLIFY = FALSE)))
    
    #     name  text
    # a.1    a   the
    # a.2    a quick
    # a.3    a brown
    # b.1    b   fox
    # b.2    b jumps
    # b.3    b  over
    # b.4    b   the
    # c.1    c  lazy
    # c.2    c   dog
    

提交回复
热议问题