Setting up a R Development Environment for Windows

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Setting up a R Development Environment for Windows

Post by jussij »

NOTE: It is strongly recommended usign the lastest Zeus IDE found here: https://www.zeusedit.com/download.html

That latest version comes with a R Document Type definition, but users of older versions can still manually create that definition.

Setting up a R Development Environment for Windows
The R mome page is found here: https://www.r-project.org/

Download and run the Windows installer is found here: https://cran.r-project.org/bin/windows/base/

NOTE: At the time of writing the R-4.3.1 for Windows (79 megabytes, 64 bit) installer was used for this test.

Setting up the PATH
That 64 bit installer defaults to installing to this folder location:

Code: Select all

C:\Program Files\R\R-4.3.1\bin
Before the software can be used this location needs to be added to PATH environment variable.

For information on how to do this refer to the following link: viewtopic.php?t=6176

Testing the Setup
After making the PATH changes, start the Zeus IDE and use the Tools, DOS Command Line menu to run the following command:

Code: Select all

Rscript.exe --version
Running that command should result in the following output:

Code: Select all

---------------------------------------------------------------------------
      Zeus IDE - Version 3.99am
      Copyright (c) Xidicone P/L 2023  All rights reserved.
---------------------------------------------------------------------------

Rscript (R) version 4.3.1 (2023-06-16)
If that output is not produced check the path settings made earlier to make sure they are correct.

Creating a R Program
With the Zeus IDE installed, select the R Template option as shown below:
The attachment R-template.png is no longer available
Create a new test.r file usign the code shown below:

Code: Select all

hello <- function( name ) {
    sprintf( "Hello, %s", name );
}
hello("world")
With that file as the active document use the Macros, Execute menu to run this script as shown in the image below:
r-run.jpg
r-run.jpg (111.28 KiB) Viewed 23044 times
The running of that script will result in the following tool output window:
r-execute.jpg
r-execute.jpg (88.81999999999999 KiB) Viewed 23046 times
Creating a R Grapical Program

Consider this test.r file that creates a graph using the plot function:

Code: Select all

# NOTE: The plot function creates a file called Rplots.pdf
x <- seq(-2*pi,2*pi,0.1)
plot(x, sin(x))
Running that R script using the Macros, Execute menu creates a PDF graph file and the macro will display that file in the browser as shown below:
r-plot.jpg
r-plot.jpg (121.56 KiB) Viewed 23040 times
NOTE: For details on how this works refer to the Zeus r_exec.lua found in the zScript folder.
Post Reply