I have a issue with showing R results in php.
I dont know how to configure the php file in his echo ();
to show the correct result.
# my_rscript3.R
library(class)
require(lattice)
require(ggplot2)
library(caret)
iris2=read.csv("/var/www/html/machine/iris.csv",header = TRUE)
normalizacion=function(x) {
num=x - min(x)
denom=max(x) - min(x)
return (num/denom)
}
iris2_normalizado=as.data.frame(lapply(iris2[1:4], normalizacion))
set.seed(1234)
iris2x=sample(2, nrow(iris2), replace=TRUE, prob=c(0.67, 0.33))
iris2x.training=iris2[iris2x==1, 1:4]
iris2x.test=iris2[iris2x==2, 1:4]
iris2x.trainLabels=iris2[iris2x==1, 5]
iris2x.testLabels=iris2[iris2x==2, 5]
iris2x_pred=knn(train=iris2x.training, test=iris2x.test, cl=iris2x.trainLabels, k=3)
confusionMatrix(iris1x.testLabels,iris1x_pred)
This is my r file and I want to show the the confusionMatrix()
like this in a php file
Confusion Matrix and Statistics
Reference
Prediction setosa versicolor virginica
setosa 9 0 0
versicolor 0 15 0
virginica 0 1 15
Overall Statistics
Accuracy : 0.975
95% CI : (0.8684, 0.9994)
No Information Rate : 0.4
P-Value [Acc > NIR] : 7.374e-15
and my php is written like this
<?php
// table.php
// execute R script from shell
exec("/usr/lib/R/bin/Rscript my_rscript3.R");
echo("?????????");
}
?>
Any help to fill the echo("?????????")?