How do I use arguments of a function when using sapply?

徘徊边缘 提交于 2019-12-02 08:14:16

You should read ?sapply manual. Below example of sapply with some extra arguments:

sapply(allcolscomb, sd, na.rm=TRUE)
sapply(allcolscomb, function(x) sd(x, na.rm=TRUE))

Try this.

sapply(allcolscomb,sd, na.rm = TRUE)

in the apply family functions the syntax is (data, fun, ...). The three dots are "ellipsis", they are there to host the arguments of the function passed to the apply's function.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!