خرید بک لینک

Vote count: 0

I want to execute a R script (named script.R) within PHP code with an Apache Web Server. Here is my R code : I install packages then import data then I can proceed a classification tree on the data:

library(lubridate)
library(plyr)
library(rpart)
library(sqldf)
library(survival)
library(randomForest)
library(rpart.plot)

data=read.table(file = "t.txt",header = T,sep = ";",stringsAsFactors = T)

input=read.table(file = "file.txt",header = T,sep = ";",stringsAsFactors = T)

tree=rpart(sat~.,data,method="class")


png("tree.png", width=1000, height=800, antialias="cleartype")
plot(tree, uniform=TRUE,
     main="Classification Tree")
text(tree, use.n=TRUE, all=TRUE, cex=0.8)

dev.off()

My php script must execute this R script. They are placed in "C:Apache24htdocs" with "file.txt" and "t.txt"

So my php file consists in :

<?php
exec("Rscript script.R", $results);
print_r($results);
?>

But I get "Array()"

Any idea?

asked 29 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 17 تير 1395 ساعت: 0:21

صفحه بندی