将文件从 R 保存到 SharePoint 文件夹

Saving files to SharePoint folder from R

我可以在 Rshiny 服务器上从 R 运行 打开 SharePoint 文件夹中的文件。但是,无法将文件保存到同一文件夹。我收到如下所示的错误消息。我尝试了此处 and here Copying file to sharepoint library in R 提供的解决方案,但没有成功。有什么建议吗?

df <- read.csv("http://sites.somecompany.com/sites/sitename/Documents/UserDocumentFolder/filename.csv")

write.csv(df, "http://sites.somecompany.com/sites/sitename/Documents/UserDocumentFolder/filename2.csv")

can only open URLs for readingError in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection

我尝试了这个并且成功了:

system("curl --ntlm --user username:password --upload-file someFolder/FileToCopy.ext https://sites.somecompany.com/sites/sitename/Documents/UserDocumentFolder/FileToCopy.ext")