question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Still could not find function "t.test" after EnvironmentVariables correctly setted.

See original GitHub issue

my code in asp.net mvc5:

            REngine.SetEnvironmentVariables("C:/Program Files/R/R-3.4.0/bin/i386" , "C:/Program Files/R/R-3.4.0")
            REngine engine = REngine.GetInstance();
            // REngine requires explicit initialization.
            // You can set some parameters.
            engine.Initialize();

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

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

but i still got the error below:

RDotNet.EvaluationException: Error in t.test(group1, group2) : could not find function "t.test"

   在 RDotNet.REngine.Parse(String statement, StringBuilder incompleteStatement)
   在 RDotNet.REngine.<Defer>d__0.MoveNext()
   在 System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source)
   在 RDotNet.REngine.Evaluate(String statement)
   在 Microsoft.Scripting.Interpreter.FuncCallInstruction`3.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   在 Microsoft.Scripting.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   在 Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   在 IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   在 Dengdu.Areas.Core.Cache.DdPythonCache.Exec(CompiledCode code, IDictionary variables) 位置 D:\Users\dengdu\Products\Dengdu.Areas\Dengdu.Areas.Core\Dengdu.Areas.Core\Areas\Core\Root\Cache\Lazy\DdPythonCache.cs:行号 22
   在 Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
   在 Microsoft.Scripting.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   在 Microsoft.Scripting.Interpreter.FuncCallInstruction`4.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run5[T0,T1,T2,T3,T4,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
   在 Microsoft.Scripting.Interpreter.DynamicInstruction`5.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   在 Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   在 IronPython.Runtime.PythonContext.CallSplat(Object func, Object[] args)
   在 IronPython.Runtime.Operations.PythonOps.Invoke(CodeContext context, Object target, String name, Object[] args)
   在 Dengdu.Areas.Core.Controllers.UPythonController.FromApiRslt(String rel, Object rslt, String pymethod) 位置 D:\Users\dengdu\Products\Dengdu.Areas\Dengdu.Areas.Core\Dengdu.Areas.Core\Areas\Core\Controllers\UPythonController.cs:行号 56
   在 Dengdu.Areas.Core.Controllers.UPythonController.Api(String rel, String pymethod, String ff, String fv, String args, String data) 位置 D:\Users\dengdu\Products\Dengdu.Areas\Dengdu.Areas.Core\Dengdu.Areas.Core\Areas\Core\Controllers\UPythonController.cs:行号 32
   在 lambda_method(Closure , ControllerBase , Object[] )
   在 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   在 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   在 System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rvberloocommented, Mar 21, 2018

I finally got it running. I did two more things: added the path to …bin/i386 in a different way, using forward slashes (/) rather than regular windows slashes (\) and restarted the server to make sure the path would be updated. Not sure which of these two was the key …

0reactions
ihsanycommented, Jan 1, 2019

I got same error, fixed creating the directory C:\RTools\Bin and copied all files from C:\Program Files\R\R-3.4.3\bin\i386 to C:\RTools\Bin

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get an error when I try to run t.test()
One way to do this is to convert the data set to wide format, then use na. omit() (then use the slightly weird...
Read more >
How to set "default" environment variables?
I have a few environment variables set in my "run configuration", but when I right-click a single test and click in "Run test"...
Read more >
.env Not Reading Variables Sometimes
I have the User $tz variable being set to this using getenv('DISPLAY_TZ')?:date_default_timezone_get() and then used by calling setTimezone(Auth::user()->tz) on ...
Read more >
Using Lambda environment variables
Learn how to use environment variables in Lambda. Use environment variables to adjust functions without updating code.
Read more >
How To Read and Set Environmental and Shell Variables ...
In Linux systems, environmental and shell variables are used to determine operating conditions for the shell. They can be passed down to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found