R 教材:PHP Example 2 |
<? $cmd = "echo 'argv <- \"ex_2.r\"; source(argv)' | " . "/usr/bin/R --vanilla --slave"; $handle = popen($cmd, "r"); $ret = ""; do{ $data = fread($handle, 8192); if(strlen($data) == 0){ break; } $ret .= $data; } while(true); pclose($handle); echo $ret; ?> |
dev.off.wrap <- function(){ dev.off() invisible() } bitmap(file = "%stdout", type="png256") pie(rep(1, 24), col = rainbow(24)) dev.off.wrap() |
陳韋辰 (04/08/19) --- |