PHP code example of okvpn / php-rdk
1. Go to this page and download the library: Download okvpn/php-rdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
okvpn / php-rdk example snippets
use Okvpn\R\Process\RProcess;
use Okvpn\R\UnixPipes;
$rPath = '/usr/bin/R'; //path to R
$process = new RProcess(new UnixPipes(), $rPath);
$process->start();
$rOutput = $process->write(<<<TXT
library("plot3D")
ii = which(Hypsometry\$x > -50 & Hypsometry\$x < -20)
jj = which(Hypsometry\$y > 10 & Hypsometry\$y < 40)
zlim = c(-10000, 0)
png('test.png')
persp3D(z = Hypsometry\$z[ii,jj], xlab = "longitude", bty = "bl2", ylab = "latitude", zlab = "depth", clab = "depth, m", expand = 0.5, d = 2, phi = 20, theta = 30, resfac = 2, contour = list(col = "grey", side = c("zmin", "z")), zlim = zlim, colkey = list(side = 1, length = 0.5))
dev.off()
TXT
);
print_r($rOutput->getAllOutput());
use Okvpn\R\Process\ProcessManager;
use Okvpn\R\Types\Type;
$rProcess = ProcessManager::create();
$exprBuilder = $rProcess->createExpressionBuilder();
$result = $exprBuilder
->select('t(combn(c(0:3), :b))', Type::MATRIX)
->setParameter('b', $b)
->execute()->getSingleResult();
composer