R 路径参数中的 write_xlsx 函数

发布于 2025-01-10 05:43:34 字数 405 浏览 1 评论 0原文

我在 R 中有一个脚本可以进行一些计算。最后,结果存储在像这样的数据框中。

n= 10
x= rnorm(n)
t = seq(1:n)
d = data.frame(t,x);d

我想将此脚本发送给许多人,其中一些人有 Mac,另一些人有 Windows,其中一些人有 Linux,运行脚本并将输出作为桌面上的 xlsx 格式文件。我知道如何使用函数 write_xlsx()writexl 库到我自己的桌面。但是任何人如何才能运行该脚本并在其桌面上导出 xlsx 文件呢?

可能是这样的:

write_xlsx(d,path = "my question")

但我不知道怎么做。有什么帮助吗?

I have a script in R that does some calculations.At the end the results are stored in a data frame like this one.

n= 10
x= rnorm(n)
t = seq(1:n)
d = data.frame(t,x);d

I want to send this script to many people which some of have Mac others have windows and some of them linux, run the script and the output to be a xlsx format file in their desktop.I know how to do it with the function write_xlsx() from writexl library to my own desktop.But how anyone can run the script and the xlsx file to be exported in their desktop ?

Might be something like :

write_xlsx(d,path = "my question")

but I don't know how.Any help ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情空心 2025-01-17 05:43:34

您可以使用 writexl 包来实现它:

library("writexl")
write_xlsx(d,"path/name.xlsx")

You can achieve it using writexl package:

library("writexl")
write_xlsx(d,"path/name.xlsx")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文