Script implementation of PHP invoke R

Source: Internet
Author: User
Tags mathematical functions
Because in PHP Web pages, it is unavoidable to need the powerful function of R language. Therefore, in the implementation of some mathematical functions, we need to implement the R language. The method is to use the PHP system function to invoke R script, so that the operation of R script, through the PHP file operation, so as to get R script execution results. The basic code is as follows:

    System ("F:\R\R-3.2.3\bin\R.exe--vanilla 
 
 < pre="">
  
Because it is implemented by the Windows platform, you can use the system () implementation in PHP as long as the script commands are guaranteed to run in the CMD console.

Precautions:

(1). Ensure that no Chinese characters and spaces are in the path of the system

(2). To configure the R locale in advance, add the path F:\R\R-3.2.3\bin in path

The above describes the PHP call R script implementation, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.