简体   繁体   English

如何使用RScript显示图形?

[英]How to display figures using RScript?

I know RScript is non-interactive, but I would like to display figures without running into the R interactive console first (the same way as in python and java). 我知道RScript是非交互式的,但是我想显示数字而不先运行R交互式控制台(与python和java中的方式相同)。

In other words, I am hoping to be able to run a single build command from command prompt or terminal that runs an R script and displays its figures. 换句话说,我希望能够从命令提示符或运行R脚本并显示其图形的终端运行单个构建命令。

Thanks. 谢谢。

If you are familiar with shiny you can build simple shinyApp to display file.png file in browser: 如果您熟悉闪亮的你可以建立简单的shinyApp显示file.png在浏览器中的文件:

Rscript -e 'png("file.png"); plot(1:10); dev.off(); runApp("display_png_app")'

Good comment by @Ista: you don't need to use shiny, you can simply use browseURL("file.png") command instead runApp . @Ista的好评论:不需要使用browseURL("file.png") ,可以简单地使用browseURL("file.png")命令代替runApp

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

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