Introduction to R language and. NET Integration development

Source: Internet
Author: User

First: The basic course of the R language:

Https://www.yiibai.com/r/r_environment_setup.html

Download the installation package for the R language: HTTPS://CRAN.R-PROJECT.ORG/BIN/WINDOWS/BASE/OLD/3.4.1/

NEW: vs Engineering Console

Add NuGet Package: r.net

Add test code:

 static void Main (string[] args) {rengine.setenvironmentvariables (); There is several options to initialize the engine, but by default the following suffice:rengine engine = R            Engine.getinstance ();            The. NET Framework array to R vector. Numericvector group1 = engine.            Createnumericvector (new double[] {30.02, 29.99, 30.11, 29.97, 30.01, 29.99}); Engine.            Setsymbol ("Group1", group1);            Direct parsing from R script. Numericvector group2 = engine. Evaluate ("Group2 <-C (29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").            Asnumeric ();            Test difference of mean and get the p-value. Genericvector TestResult = engine. Evaluate ("T.test (group1, Group2)").            Aslist (); Double p = testresult["P.value"]. Asnumeric ().            First (); Console.WriteLine ("Group1: [{0}]", String.            Join (",", group1)); Console.WriteLine ("Group2: [{0}]", String.            Join (",", group2)); COnsole.            WriteLine ("P-value = {0:0.000}", P);            You should always dispose of the rengine properly. After disposing of the engine, you cannot reinitialize nor reuse it engine.            Dispose ();        Console.readkey (); }

Operation Result:

Introduction to R language and. NET Integration development

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.