在 Dropbox 上为闪亮的应用程序创建 PNG 文件

Creating png file on dropbox for shiny app

我实际上正在创建一个托管在 shinyapps.io 上的闪亮应用。 为了阅读和使用我的数据,我使用 rdrop2 包与保管箱帐户进行通信。 我想根据用户在我的保管箱中的输入创建一个 png 文件。 通常,我会像这样在我的工作目录中创建 png 文件:

png("test.png") 
plot(...) 
dev.off()

我不仅将绘图保存为 PNG,还 grid.tables。

我可以使用 'drop_get' 功能从我的保管箱中获取文件。

我唯一的问题是我不知道如何将即时创建的 png 直接保存在我的保管箱中。我试图将我的 PNG 文件保存在像 varPNG<-png('test.png')... 这样的变量中,并使用 'drop_upload' 函数保存它,但它不起作用。

有人可以帮助我吗?

编辑: 我对闪亮的应用程序不够熟悉,无法提供帮助,抱歉。 虽然我确实找到了这个东西:http://shiny.rstudio.com/gallery/image-output.html 这可能会帮助你。

基本上 shiny 似乎有一个 renderImage 功能来管理图像的创建。希望这有帮助。

旧答案:

包的文档是 here 以供参考。

确保您已允许 rdrop2 访问您的保管箱(参见 link)!

来自link:

write.csv(mtcars, 'mtcars.csv')
drop_upload('mtcars.csv')
# or upload to a specific folder
drop_upload('mtcars.csv', dest = "drop_test")

You can also do this for any other file type and large files are supported regardless of your memory.

因此,您不应将图像存储在变量中并尝试上传它。 而是像往常一样保存文件,然后执行:

drop_upload("filename.png")