Run R Script

Run R Script

Install Packages

We need to install the required package before running the script.

  • Method 1: run the script install.packages('<package name>')

  • Method 2: in the menu option Packages, click Install package(s)..., and select the package you want to install

Trouble Shooting

rJava installation error"

Loading required package: rJava Error: package or namespace load failed for ‘rJava’: .onLoad failed in loadNamespace() for 'rJava', details: call: fun(libname, pkgname) error: JAVA_HOME cannot be determined from the Registry Error: package ‘rJava’ could not be loaded

Solution: https://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/

Basically, you need to install JAVA (64-bit version should be downloaded manually, since only 32-bit one is installed by default) and set environment variable JAVA_HOME.

Run R Script

  1. Open the script file and select all the source code

  2. Click