C#.NET程序调用R

时间:2023-01-29 14:28:52

#-------方法1:R(D)COM Server----------

官网上不建议在Windows下使用Rserve,因为会丧失很多性能,他们推荐可以考虑DCOM的方式。
install.packages("RDCOMServer")   # not available for R 3.3.3
library("RDCOMServer")

using STATCONNECTORCLNTLib
参考:https://cos.name/cn/topic/103438/

#-------方法2:R.NET--------------
R.NET使.NET语言(包括C#)能够与R语言进行交互集成,他们运行在同一个进程中。R.NET需要使用.NET Framework 4 和随R环境一起安装的R DLL。
遗憾的是,R.dll不支持多线程,因此不太适合用来构建web程序。详细:http://rdotnet.codeplex.com/discussions/267550

参考:

http://jmp75.github.io/rdotnet/
http://blog.csdn.net/cyb6100300115/article/details/12835819
http://www.cnblogs.com/smilejian/p/4750235.html
https://rdotnet.codeplex.com/workitem/117

#----------方法3:RServe-----------------------
主要是基于Linux。在Windows下的稳定性和安全性不是很好,同一时间只能支持一个连接(单线程)。

参考:
http://rservecli.codeplex.com/
http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/Urbanek.pdf