문제

Say I have a basic r script:

require(gWidgets2RGtk2)
w<-gbasicdialog("Stage 1.5")
visible(w)

I save it, and attempt to run it with command prompt using a batch file that looks like this:

@echo
"C:\Program Files\R\R-3.0.2\bin\x64\Rscript.exe" "C:\Users\Me\Desktop\test\test.r"
PAUSE

When I attempt to run this script, I get this error after all the packages are loaded:

Error in UseMethod(".gbasicdialog") :
  no applicable method for '.gbasicdialog'applied to an object of class "NULL"
Calls: gbasicdialog -> .gbasicdialog
Execution halted

Can anyone see if I am doing anything wrong?

도움이 되었습니까?

해결책

Change the script to this:

options(guiToolkit="RGtk2")
library(gWidgets2)
w <- gbasicdialog("Stage 1.5")
visible(w)

Also I assume you meant @echo off as the first line in the batch file. The PAUSE statement could be omitted.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top