fft fails

May 9, 2011 at 10:43 AM



fails with:   "An unhandled exception of type 'RDotNet.ParseException' occurred in R.NET.dll    Additional information: Error in the application."          

System.Numerics has been referenced.Is it a bug or am I missing something?

Thanks, best regards,


May 11, 2011 at 1:54 AM


I tried it, but no error occurred. Probably, you forget to install the 'mat' matrix in R environment. If you create a matrix in .NET environment, you need to call SetSymbol before reference of the matrix (and CreateSomethingMatrix to convert into R object).

May 11, 2011 at 9:10 AM

The problem must be elsewhere: I use it in the following way:

public static void Fft(double [,] matice)   {

           REngine.SetDllDirectory(@"C:\Program Files\R\R-2.12.2\bin\i386");

            using (REngine engine = REngine.CreateInstance("RDotNet", new[] { "-q" }))  // quiet mode            {        

          NumericMatrix mat = engine.CreateNumericMatrix(matice);             

engine.SetSymbol("mat", mat);

                NumericVector spekt = engine.EagerEvaluate("v=mean(mat)").AsNumeric();   // works!!               

                NumericMatrix  spekt2 = engine.EagerEvaluate("f=Re(fft(mat))").AsNumeric(); // doesnt work!!   

// debugger writes:  "Managed Debugging Assistant 'CallbackOnCollectedDelegate' has detected a problem in 'C:\DMT2000\Components\stbe\Dll\Fourier.vshost.exe'.Additional Information: A callback was made on a garbage collected delegate of type 'R.NET!RDotNet.Internals.blah3::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called."

Don't you have any other idea?

Thank you in advance,


May 11, 2011 at 10:57 AM

I found what is on...

fft is a part of stats library which is not attached. (the same e.g. for "cor") I can see it using RDotNet.CharacterVector slova = engine.EagerEvaluate("search()").AsCharacter();

However,  engine.EagerEvaluate("library(stats)");  fails from some reason.

So, how can I load the stats library?



May 11, 2011 at 1:07 PM


this discussion may help you: