r - R:在函数中指定输出保存名称
问题描述
我试图在我的函数中指定输出文件,这在 R 中可能吗?
X 是我的数据集,例如 Indexreturns$marketreturn 因为 ZI 然后想指定我想如何调用我的输出并将其发送到 tex 文件。
我的功能如下:
ProcessIndexReturns <- function(x,z){
z <- describe.by(x,group=Indexreturns$group)
x <- describe(x)
z <- rbindlist(z)
z <- rbind(z,x)
z <- z[c(1,4,5,6,7,8,9,10,11,2,3,12),c(4,3)]
z <- z %>%
mutate(Sharpe = (12*mean)/(sqrt(12)*sd)) %>%
mutate(`Equity Premium `= 12*mean*100) %>%
mutate(sd = sqrt(12)*sd*100) %>%
select(-mean)
z <- z[,c(2,3,1)]
row.names(z) <- c("1820","1830","1840","1850","1860","1870","1880","1890","1900","1910","1920","Full Sample")
print(xtable(z, type = "latex"), file = "z.tex")
}
如果我插入 X 和 Z,我想接收一个名为 z 的 data.table 和一个名为“z”.tex 的输出文件
解决方案
推荐阅读
- google-cloud-platform - 在 BigQuery 中运行联合查询到 Postgres Cloud SQL 实例时出现连接错误
- c++ - 删除旧的信号量 systemV
- javascript - 移动到 Windows 10 操作中心的 Chrome 通知无法清除?
- java - 使用 JPA 计算特定列
- javascript - 如何使用 puppeteer 生成可编辑的 PDF
- python - 为什么使用 docker-compose 在 Docker 容器中 Python 进程的父 pid 有时为 0?
- macos - Minikube 无法在带有 VPN 的 Mac 上启动
- javascript - 将包含填充数据的完整 HTML Web 表单从浏览器获取到电子邮件或 PDF
- java - 一个函数,它获取一个链表和一个数字并更改列表,使其由总和为给定数字的对组成
- c# - 寻找有关我的单元测试用例逻辑 c# 控制台应用程序的建议