これらのファイルがあるとしましょう
通常.R
//plot normal distribution from userData
//save image to disk
//return json with filename
controller.php
$functionId = $_GET['functionId']
switch($functionId){
case 1:
//call normal.R with $_POST['userData'] as json
break;
}
ajax.js
$.post('/controller.php?functionId=1,{post:userData},function(data){
//set the src of an specific image to the returned one in the json
})
ご覧のとおり、rApache で提供されている方法で、html で R と対話する必要はありません。R に json を渡し、R から json を取得したいだけです。Exec スクリプトは webhoster ではサポートされていません。http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-Web-Interfacesも調べましたが、私のニーズには合っているようです。
誰でも簡単な解決策を提供できますか?