R 中应用函数族的命名/名称 [英] Naming / Names of the apply function family in R
问题描述
我目前正在学习 R.特别是我需要记住 apply
函数系列中的函数(例如 lapply
、sapply
、mapply
等).我知道 apply
-function 系列中的每个函数的作用(尤其是 这个答案 有很大帮助),但有时会混淆名称.
I'm currently studying R. In particular I need to remember the functions in the apply
-function family (e.g. lapply
, sapply
, mapply
, etc.). I know what each function in the apply
-function family does (especially this answer helps a lot), but mixes the names up from time to time.
每个应用函数的前缀是否有自然含义(如lapply = 'list'-apply
)?
Is there a natural meaning for the prefix of each apply function (like lapply = 'list'-apply
)?
推荐答案
是的,您获得了以下 apply
r-基本功能:
Yes, you got following apply
r-basic functions:
apply
for apply ;)lapply
for lists or vectors (documentation)vapply
for specific return value (documentation)
sapply
简单 (文档)
mapply
用于多个列表或向量参数(文档)
tapply
for table(检查旧问题 这里)
tapply
for table (check old question here)
rapply
用于递归(文档)
我认为您可以以不同的方式解释某些前缀,例如在评论中将 m
称为多元(评论已删除).我尝试使用文档的措辞,因此更容易被理解.
I think you can interprete some prefix differently, like m
was mentioned in the commentary as multivariate (commentary got removed). I tried to use the wording of the documentation, so it's more likely to be understood.
还有 lapply
、sapply
和 vapply
位于同一个文档站点中,因为 sapply
和 vapply
是 lapply
Also lapply
, sapply
and vapply
are in the same documentation site, since the sapply
and vapply
are wrapper for lapply
这篇关于R 中应用函数族的命名/名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!