[R] Please Help how to execute R via php script
Joseph Mbowe
mbowej at nm-aist.ac.tz
Tue Aug 18 09:49:22 CEST 2015
Dear R members, I want to call my R script thorough php but no I am not
getting output
When I call my r script by bat file works fines also when run by Rstudio it
works fines
but when i cant call via php
here is the php code:
<?php
exec('C:/"Program Files"/R/R-3.2.0/bin/i386/Rscript.exe
C:/xampp/htdocs/postam/DrawGraph.R"')
echo '<img src="C:/xampp/htdocs/postam/radargplot100.png?t='.time().'"
style="height:600px;width:auto;" />' ;
?>
here is R script
args=(commandArgs(TRUE))
library(ggplot2)
library(readxl)
#library(RMySQL)
#library(readxl,lib.loc ="C:\Program Files\R\R-3.2.0\bin\i386")
library(RMySQL,lib.loc ="C:/Users/Mbowe/Documents/R/win-library/3.2")
library(arulesViz, quietly=TRUE)
drv_postam = dbDriver("MySQL")
con = dbConnect(drv_postam, user="root",
dbname="evtlogr",host="localhost")
tbl_data2<-dbGetQuery(con,"select * from `tblsevtlogs` where datetime
BETWEEN '5/20/2015' AND '5/28/2015';")
closeAllConnections()
head( tbl_data2)
tail( tbl_data2)
#summary(data)
w1 =
table(tbl_data2$evtcategory,tbl_data2$evttype,tbl_data2$evt_usr_source)
t1 = as.data.frame(w1)
t1
LogonType<-t1$Var1
LogonTypeCount<-t1$Freq
Yaxis<-paste(paste("Frequency Count"))
user_obj<-paste("User: ",tbl_data2$evt_usr_source)
myplot <- ggplot(t1, aes(y = LogonTypeCount, x = reorder(t1$Var2,
t1$Freq),
group = LogonType, colour = LogonType)) + coord_polar()
+ geom_point(size=3) + geom_path(size=1) +
labs(x = paste("Data Mined From (",user_obj,")", "Event Logs"),y=Yaxis)
ggsave(file="C:/xampp/htdocs/postam/radargplot100.png")
dev.off()
[[alternative HTML version deleted]]
More information about the R-help
mailing list