PHP code example of texlab / r

1. Go to this page and download the library: Download texlab/r 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/ */

    

texlab / r example snippets




header("Content-Type: text/plain");

use TexLab\R\Runner;

y(lm(y~x));
R;

echo $r->run($code);



use TexLab\R\Script;
use TexLab\R\Runner;

brary(base64enc)

temp_file_name <- tempfile()

png(file = temp_file_name, width = 300, height = 300, units = "px");

hist(x=rnorm(1000), col='blue');

dev.off();

php_plot_data <- paste("data:image/png;base64,", base64enc::base64encode(temp_file_name))

file.remove(temp_file_name)
R;

$data = $r->run($code)