如何在中安装R和RApache?
我对XAMPP、unix和服务器环境很陌生。我在谷歌上搜索过,但在将PHP、XAMPP、Windows和R组合放在一起时找不到多少。
我正在尝试编写一个网页,通过PHP exec()函数将变量传递给R。最终用户希望在参数上画ggvis图,所以R是必要的。
我正在Windows 8.1上运行XAMPP。基本安装工作正常,但我坚持用exec()传递变量,因为我的XAMPP环境中没有安装R或RApache,尽管在我的Windows环境中有R。
我试过了rApache安装说明。
在shell上运行'sudo apt-get install devscripts git'将返回错误
“‘sudo”不被识别为内部或外部命令、可操作的程序或批处理文件。
发布于 2016-04-21 18:27:39
误差sudo is not recognized as an internal or external command, operable program or batch file is because, you are trying to run Linux command on window shell ( command prompt)。我认为在XAMPP上集成R、Apache、MySQL、PHP是不可能的。我很好奇,如果有人有新的解决方案,我会学到更多。但是,正如您在注释中提到的,使用exec所需的只有R脚本的路径。这是一个正在工作的R脚本
php/html脚本
<?php
error_reporting(E_ALL & ~E_NOTICE);
if(isset($_GET['N'])) {
$N = $_GET['N'];
exec("\"C:\\Program Files\\R\\R-3.2.3\\bin\\Rscript.exe\"
C:\\my_folder\\www\\R-scripts\\Test.R $N", $output);
echo '<pre>', join("\r\n", $output), "</pre>\r\n";
$nocache = rand();
echo("<img src='temp.png?$nocache' />");
}
$out .= "
<form method='get'>
Number values to generate: <input type='text' name='N' />
<input type='submit' />
</form>";
echo $out;R-脚本
args <- commandArgs(TRUE)
N <- args[1]
x <- rnorm(N,0,1)
print(x)
png(filename = "temp.png", width=500, height=500)
hist(x, col = "lightblue")但是,我想知道是否有来自R的更新包,还是来自PHP的模块来集成R和php。有任何专家可以更新这个主题吗?
https://stackoverflow.com/questions/33685846
复制相似问题