0

I'm trying to run my Rscript(.r file) in cmd with parameters, but this is not working. I want to add two numbers and display their result, so for this I'm passing two numbers in the cmd for which I want to perform addition This is my file cat1.R

library(getopt)
print("hello")
args <- commandArgs(trailingOnly = TRUE)
rnorm(n=as.numeric(args[1]), b=as.numeric(args[2]))
c = n + b
print(c)

This is the command to execute cat1.R in cmd

C:\Users\ypoint\Downloads>Rscript cat1.R 5 100

it gives my an error

'Rscript' is not recognized as an internal or external command,
operable program or batch file.

Any help on this would be much appreciated.Thanks

Deepesh
  • 820
  • 1
  • 14
  • 32
  • 1
    Check this [out](http://stackoverflow.com/questions/10077689/r-cmd-on-windows-7-error-r-is-not-recognized-as-an-internal-or-external-comm). – Chirayu Chamoli Oct 21 '16 at 07:28
  • The R program directory isn't in your path. It's probably something like `c:\program files\R\R-x.y.z\bin`. Add that to your path and see if it works. – Hong Ooi Oct 21 '16 at 07:33

0 Answers0