r - cat 函数中的 R 汇总函数导致问题
问题描述
我无法将带有 cat 函数的线性回归模型的摘要打印到文本文件中。产生错误的代码行
cat(summary(model), file = "results.txt", sep = "\n")
此行产生错误:
argument 1 (type 'list') cannot be handled by 'cat'
我想不出办法来解决这个问题。这是什么原因造成的?
解决方案
Here is a capture.output
solution.
model <- lm(Sepal.Length ~ Sepal.Width, iris)
capture.output(summary(model), file = "results.txt")
推荐阅读
- git - 预提交:如何禁用对未暂存文件的检查?
- apache-spark - Spark - 在数据集中查找最常见的单词
- javascript - Geofirestore 从 react-native 中的地理集合中获取子集合
- python - 模拟在不同模块中导入的类
- spring-boot - Spring Cloud Zuul 网关无法在响应中添加自定义标头
- android - 什么是支持兼容库的 AndroidX 等价物?
- python - dblpy 事件未被调用
- javascript - 在 Vuetify 中垂直对齐多个 v-slide-group
- javascript - 谁能解释一下这段代码的输出?
- c# - URL has been blocked by CORS policy