0
     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# . I tried to get the data inside the date input for the date was 2014-10-10. but the value in date inside R was 1993. I'm confused about it.

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213

1 Answers1

0
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+"'");