[英]I want to read from the command line in a .net console application and using r.net package i want to use that data for R
REngine.SetEnvironmentVariables();
REngine engine = REngine.GetInstance();
engine.Evaluate("load('~/Shiny.RData')");
Console.WriteLine("Enter Date:");
String date1 = Console.ReadLine();
engine.Evaluate("date<-as.character(" + date1+ ")");
var date_in_r = engine.Evaluate("date").AsCharacter()[0];
engine.Evaluate("weekno<-strftime(as.POSIXlt(date),'%w')");
The problem here is taking the input for date. 这里的问题是将输入作为日期。 I'm very new with the .net and c# .
我对.net和c#非常陌生。 I tried to get the data inside the date input for the date was 2014-10-10.
我试图获取日期输入为2014-10-10的日期内的数据。 but the value in date inside R was 1993. I'm confused about it.
但是R中的date值是1993。对此我感到困惑。
engine.Evaluate("date<-as.character(" + date1+ ")");
There is an error in this line since the you are trying to enter 由于您要输入的是这一行,因此存在错误
date<-22-12-10
It should be 它应该是
date<-'22-12-10'
so it will be 所以会的
engine.Evaluate("date<-'"+date1+"'");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.