What's the difference between lapply and do.call?

前端 未结 7 1248
孤独总比滥情好
孤独总比滥情好 2020-11-29 14:46

I\'m learning R recently and confused by two function: lapplyand do.call. It seems that they\'re just similar to map function in Lisp.

7条回答
  •  清酒与你
    2020-11-29 15:00

    lapply() is a map-like function. do.call() is different. It is used for passing the arguments to a function in list form instead of having them enumerated. For instance,

    > do.call("+",list(4,5))
    [1] 9
    

提交回复
热议问题