I have a problem, e am executing a R script from php via command line, and i need to give it two arrays for calculation.
I call the script by running:
Rscript nls.R ??? ???
??? and ??? are my arrays that i need to “give” to R, in order for it to calculate certain values.
Anyone knows how to do this? It is not limited to php, because it is command line – i just need to know if an array can be passed to R via command line and how.
How would R catch it, with what command?
Thanks a lot.
Regards
The command you are looking for is
commandArgs().Now, if you have for example a list if integers separated by commas in a string, you can get the integers
There might be more straight-forward ways achieving this.
EDIT:
better example (should also work with Rscript)