Working with R Script with c("a","b","c") as argument

Hello,

I am trying to pass c("a","b","c") as an argument to a script as command line argument.
If i run the script in R-Studio with stated argument, it works fine.
But if i run script through my application then it fails.

Please support me if anyone can.
Thanks,
Ojas

Hi,

Your description is not very detailed, but here is an example for calling a script (in Linux) and passing it arguments

On the command line:

Rscript myScript.R argA agrB argC

In the R-script itself:

#!/usr/bin/env Rscript
args = commandArgs(trailingOnly = TRUE) 

a = args[1]
b = args[2]
c = args[3]

... here goes rest of code ...

Hope this helps, if not, please provide more details
PJ

Thanks pieter..,

I have already tried as you said above.. But problem is,
I am calling rscript from my C# code with argument as below
args<-commandArgs(TRUE)
a <- args[1]
for args[1] expected c("a","b") but when i debugged my code then found argument passed to my script like "c(a,b)" which produces different output.

Hi,

Please show us the C# and the R code you use when you get this error so we can see what's going on.

PJ