简体   繁体   English

在Mac上使用write.table和file.choose创建文件

[英]Creating a file with write.table and file.choose on Mac

I am a PC user and have used the write.table (and write.csv) extensively. 我是PC用户,已经广泛使用了write.table(和write.csv)。 I am teaching students how to use R, but some of them use a Mac. 我正在教学生如何使用R,但是其中一些人使用Mac。

On a PC, the following code: 在PC上,以下代码:

write.table(mydata, file.choose(), row.names=F, col.names=T) write.table(mydata,file.choose(),row.names = F,col.names = T)

opens up a browser window, allowing the user to specify the folder where to save the new file, and specify the file name and extension. 打开浏览器窗口,允许用户指定保存新文件的文件夹,并指定文件名和扩展名。 (Strangely enough, the user is then prompted to click the button "Open" to create a file.) (奇怪的是,然后提示用户单击“打开”按钮来创建文件。)

On a Mac however, it appears there is no way of specifying the name and extension of the file being created, once the window opens. 但是,在Mac上,打开窗口后,似乎无法指定要创建的文件的名称和扩展名。 In other words, there does not seem to be a way to actually create a file. 换句话说,似乎没有一种实际创建文件的方法。 Am I missing something? 我想念什么吗?

Is the solution simply to replace the "file.choose()" with the full path to the new file? 解决方案是否只是用新文件的完整路径替换“ file.choose()”?

LGTM: LGTM:

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Having said that, if your student is using RStudio then you would normally need to go to their github repo and file an issue but I've already done that https://github.com/rstudio/rstudio/issues/3903 . 话虽如此,如果您的学生正在使用RStudio,则通常需要转到他们的github存储库并提出问题,但是我已经做到了https://github.com/rstudio/rstudio/issues/3903 They seem to intercept the call and pass it to Qt which is not honoring it (it's not a macOS issue but a Qt issue). 他们似乎拦截了呼叫并将其传递给不兑现它的Qt(这不是 macOS问题,而是Qt问题)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM