我发现很多例子将单个函数强制转换为其名称的长度为1的字符向量。我试图能够为矢量/功能列表执行此操作,但我无法使其正常工作。见下面的代码:
# singular working example
as.character(bquote(mean))
[1] "mean"
# other singular example
deparse(substitute(mean))
[1] "mean"
# my vector of functions
funsVector <- c(mean, median, sd, mad, IQR)
# failure 1
sapply(funsList, bquote)
[[1]]
X[[i]]
[[2]]
X[[i]]
[[3]]
X[[i]]
[[4]]
X[[i]]
[[5]]
X[[i]]
# failure 2
sapply(funsList, function(x) deparse(substitute(x)))
[1] "X[[i]]" "X[[i]]" "X[[i]]" "X[[i]]" "X[[i]]"
我在这里缺少什么?