Creating simple GUI for R - Calling scripts from R-external Application

#1
Dear all,

today i would like to get some directions for the following question.

Main Target - create a simple GUI which allows non R-Users to start R-Sripts, point at files and simply press run.

I have produced a code in R which basically does the following thing:

1. Check if all packages are up to date and load them (if not installed - install)
2. Open a file window(file choose) so user can select file 1
3. Open a file window(file choose) so user can select file 2
4. Analyze stuff in files 1 and 2 and export as an excelfile to a pre-defined area)
5. Open a file window(file choose) so user can select file 3
6. Analyze stuff in file 3 and export as an excelfile to a pre-defined area) - also graphics are created and saved there
7. Programm is done

Wire Frame to Solution: A simple Window with three data-Fields where the user has to pre-determine which data is file 1, 2 and 3. Two Buttons - "Run" and "Cancel". This window should be opened like an "Exe-file", sothe user does not need to start R manually or type in code into the R-Console to start any R-based GUI. It should be a simple caller where simple pointers are made which give the underlying R-Code a direction at the needed files.

I understand that R has to be installed on the users Computer.

What i envision is a GUI done with JAVA for example. My programming skills are very basic - i can work with R and i am wiling to learn a new language to give the powers of R to users which only need to point out data, which needs to be analyzed and exported-

Shiny is nice, but i need to install the app on the individual desktop environment.

What are your propositions - right now only JAVA comes to mind. Are there easy to follow examples of integrating JAVA and R?

Thank you!
 

trinker

ggplot2orBust
#2
I have had similar needs and used a .bat file to accomplish this. Not as flexible as what you describe but essentially coworkers drop a file into a folder with a .bat file that they can click. This in turn runs the R script and operates on the file they placed into the folder. This is the most straight forward for you and your end user if it can suit your needs.
 
#3
I have had similar needs and used a .bat file to accomplish this. Not as flexible as what you describe but essentially coworkers drop a file into a folder with a .bat file that they can click. This in turn runs the R script and operates on the file they placed into the folder. This is the most straight forward for you and your end user if it can suit your needs.
Dear Tyler,

thx for your reply. I will look into creating a batch file to execute an R-script. It seems pretty straight forward and easy to achive. Maybe i can alter the R-Code so one Batch-execution will do what my coworkers need.

I have looked for an how to on the internet and found this

http://www.statmethods.net/interface/batch.html
http://stackoverflow.com/questions/6788928/how-to-run-a-r-language-r-file-using-batch-file

- do you have a better source?

Thx!
 
#6
Hi there!

I guess what ur really asking is that how you can make your system know how to execute R files?

Well, that all depends on your system of course...

On Windows:
a) u can use a batch file as suggested
b) u can tell Windows what to do with the file extension ".r" (configuratie - standaard programma's)
c) u can create a shortcut on the desktop that incorporates how the ".r" file should be executed

I would suggest either option b or c on Windows, depending on your organisation structure. Option b uses the Windows registry, and gives the power to seperate "developers" from "users", so that when a user dblclicks the file it just runs, and when a developer dblclicks it, it open R-Studio or so.
Option c also works great in networked environments when you want ALL users to have a desktop icon to run the program (e.g. make it part of the standard user profile). Developers are then assumed to know how and where to edit the R-contents.

On Linux, Mac, Whatever, you have the same choices.

Using JavaScript as a mediator does not make any sense, because:
a) Java must be installed on all clients
b) U still need some user interface to start the JavaScript

So it's just an extra (unneeded) layer to start your program.
 
Last edited:
#7
Hi there!

I guess what ur really asking is that how you can make your system know how to execute R files?

Well, that all depends on your system of course...

On Windows:
a) u can use a batch file as suggested
b) u can tell Windows what to do with the file extension ".r" (configuratie - standaard programma's)
c) u can create a shortcut on the desktop that incorporates how the ".r" file should be executed

I would suggest either option b or c on Windows, depending on your organisation structure. Option b uses the Windows registry, and gives the power to seperate "developers" from "users", so that when a user dblclicks the file it just runs, and when a developer dblclicks it, it open R-Studio or so.
Option c also works great in networked environments when you want ALL users to have a desktop icon to run the program (e.g. make it part of the standard user profile). Developers are then assumed to know how and where to edit the R-contents.

On Linux, Mac, Whatever, you have the same choices.

Using JavaScript as a mediator does not make any sense, because:
a) Java must be installed on all clients
b) U still need some user interface to start the JavaScript

So it's just an extra (unneeded) layer to start your program.
Thank you for your comment. You are proposing an interesting alternativ to the creation of a bat-file. Yet i must say i do not understand how options b and c would be realised. Can you give me an example? I am happy so far with the Batchrun via Bat-file which enables users to run r code. But knowing alternatives can never hurt.:eek: