I\'m relatively new to R and very new to the Linux (Ubuntu) command line. I\'m trying to write a page in PHP that contains a command I would like to execute in R and then pa
For something this simple, you shouldn't even use PHP, 'cause you can do it solely with RApache, brew package and plain HTML (CSS/JS are optional). Just read the RApache manual and see Jeroen Ooms' video tutorial. You should also read brew manual. Jeff really did a great job!
In a nutshell, you just need to setup apache2.conf or .htaccess file. Instead of using or directives, you can use directive so you can match files with regexpr. Here's a sample .htaccess:
SetHandler r-script
RHandler brew::brew
I use special file extension .rhtml where I mix HTML with R syntax within <% and %> tags (see brew documentation). I didn't use brew with PHP, 'cause brew with HTML did the trick.
Anyway, you said that you want to:
write a page in PHP that contains a command I would like to execute in R and then pass the results back to be able to work with them
system or file.* commands and mess your system up! You can use AppArmor, but it's still a long way down...XML R package, or rjson (my favourite, and I recommend it). Then you can pass R object to toJSON function and unserialize it with JavaScript. Of course, that's true only if your clients are web-browsers, otherwise, if you, say, want to pass some info to embedded system, you should use the standard XML-wayFor any further questions, use RApache mailing list.
...and hello R-webdev world! =)