Foro de debate

Integrar R con php

Integrar R con php

by Daniel Valdivieso -
Number of replies: 0
tengo un problema necesito usar codigo de R en paginas creadas mediante php tengo este ejemplo pero no me muestra la imagen del histograma

<?php // poorman.php echo "<form action='poorman.php' method='get'>"; echo "Number values to generate: <input type='text' name='N' />"; echo "<input type='submit' />"; echo "</form>"; if(isset($_GET['N'])) {  $N = $_GET['N'];  // execute R script from shell // this will save a plot at temp.png to the filesystem exec("Rscript my_rscript.R $N"); // return image tag $nocache = rand();  echo("<img src='temp.png?$nocache' />"); } ?>
--------------------------------------------------- R script 
# my_rscript.R  args <- commandArgs(TRUE)  N <- args[1]  x <- rnorm(N,0,1)  png(filename="temp.png", width=500, height=500)  hist(x, col="lightblue")  dev.off()
podrian ayudarme a como hacer la integracion entre R y php sea en windows o linux