搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  r.net.community.1.6.5.zip
资料下载链接地址: https://bbs.pinggu.org/a-2430126.html
本附件包括:
  • r.net.community.1.6.5.nupkg
附件大小:
70.76 KB   举报本内容
配置的方法参考了csdn的帖子http://blog.csdn.net/cyb6100300115/article/details/12835819
但在运行测试代码时
REngine.SetEnvironmentVariables();” 和“REngine engine = REngine.GetInstance();


提示两个函数未定义,转到REngine下看确实没有这两个函数,请问如何解决?

环境:r.net是1.5.5版本,vs2010解决方案 x64,rgui 3.2.2x64

测试代码如下:
  1. using System;
  2. using System.Linq;
  3. using RDotNet;

  4. namespace Sample1
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. REngine.SetEnvironmentVariables();
  11. // There are several options to initialize the engine, but by default the following suffice:
  12. REngine engine = REngine.GetInstance();

  13. // .NET Framework array to R vector.
  14. NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 });
  15. engine.SetSymbol("group1", group1);
  16. // Direct parsing from R script.
  17. NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric();

  18. // Test difference of mean and get the P-value.
  19. GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList();
  20. double p = testResult["p.value"].AsNumeric().First();

  21. Console.WriteLine("Group1: [{0}]", string.Join(", ", group1));
  22. Console.WriteLine("Group2: [{0}]", string.Join(", ", group2));
  23. Console.WriteLine("P-value = {0:0.000}", p);

  24. // you should always dispose of the REngine properly.
  25. // After disposing of the engine, you cannot reinitialize nor reuse it
  26. engine.Dispose();

  27. }
  28. }
  29. }
复制代码





    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-7 22:50