r - R中的包装函数
问题描述
以下代码由五个函数组成。运行wrapTables时,只输出t表?如何解决每个表格的输出,例如“卡方表”,然后是卡方概率表?谢谢。
毫米
wrapTables <- function() {
chistable()
ftableb()
normtab()
poissontable2()
ttable()
}
wrapTables()
解决方案
考虑返回一个包含每个函数输出的命名列表:
wrapTables <- function() {
list(Chi_Square_Table = chistable(),
F_Table = ftable(),
Norm_Table = normtab(),
Poisson_Table = poissontable2(),
T_table = ttable()
)
}
然后任何分配给此函数的对象都将具有相应命名的元素:
output <- wrapTables()
output$Chi_SquareTable
output$F_Table
output$Norm_Table
...
或全部一起但以列表格式:
output
推荐阅读
- android - 通过 gcm 从 firebase 发送通知后对本机应用程序崩溃做出反应
- bash - 如何在 Windows 代理上从 Jenkins groovy 执行 git 命令?
- python - 将 txt 文件的多行与 python 中的单个变量进行比较
- visual-studio-2017 - 我们可以在 Visual Studio 2017 C++ 中构建并且仍然符合 MISRA C++ 吗?
- c# - System.Text.Json:如何将 JsonConverter 应用于具有集合项目的自定义转换器的集合?
- coq - ssreflect 中的字符串比较
- python - 当计数器变大时,它会变得越来越慢吗?
- reactjs - 从 CRA 迁移到 Gatsby 破坏了 JSS 插件
- python - 加载 word2vec 模型时出现数组重塑错误
- ios - life360 等应用程序如何在终止状态下获取位置更新?