1
votes

running RProvider1.1.20 on a Terminal window on MacOS

I try to run the example from http://bluemountaincapital.github.io/FSharpRProvider/mac-and-linux.html

R.mean([1;2;3;4)] R.x11() R.sin(1)

> R.sin(1.0);;

val it : RDotNet.SymbolicExpression = [1] 0.841471

all work fine

However >R.sin(1.0);; Error in base::sin(0, 1) : 2 arguments passed to 'sin' which requires 1

RDotNet.EvaluationException: Error in base::sin(0, 1) : 2 arguments passed to 'sin' which requires 1

at RDotNet.REngine.Parse (System.String statement, System.Text.StringBuilder incompleteStatement) [0x000a0] in :0 at RDotNet.REngine+d__0.MoveNext () [0x0008f] in :0 at System.Linq.Enumerable.LastOrDefault[TSource] (System.Collections.Generic.IEnumerable1[T] source) [0x00042] in <2392cff65f724abaaed9de072f62bc4a>:0 at RDotNet.REngine.Evaluate (System.String statement) [0x0000d] in <bc069eb3146d4bcda8475794f512037f>:0 at [email protected] (Microsoft.FSharp.Core.Unit unitVar0) [0x00026] in <57161c90b86b2a10a7450383901c1657>:0 at RProvider.Internal.Logging.logWithOutput[a] (RProvider.CharacterDeviceInterceptor characterDevice, Microsoft.FSharp.Core.FSharpFunc2[T,TResult] f) [0x0007e] in <57161c90b86b2a10a7450383901c1657>:0 at RProvider.RInteropInternal.eval (System.String expr) [0x0000c] in <57161c90b86b2a10a7450383901c1657>:0 at .$FSI_0028.main@ () [0x00046] in <23b88108285f4035b1dcf54f78a47062>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in :0 Stopped due to error

I first wondered if it had to do with regional settings (comma or dot separator for numbers) but the example with 0.1 and 1.0 suggest otherwise

this is a x-post as I also posted this issue in the RProvider GitHub here https://github.com/BlueMountainCapital/FSharpRProvider/issues/186

1
I'd say Error in base::sin(0, 1) still points to locale issues. Can you set it to C or US and see what happens? 1.0 might just come through as 1, so maybe trying it with 2.99 and 2,99 can give you a better idea? Or maybe do double parentheses sin((0.1))? - s952163
how do u change those settings ? is that a setting at the OS level ? or at the R level ? - Fagui Curtain
Both. I don't know how to change locale/region for OS X. I assume 1. there is some system setting to do it, 2. You can set the locale for your Terminal just like a normal shell (again assumption): either set LANG or LC_ALL to C or some US locale, 3. you can set locale for R: Sys.setlocale("LC_ALL", 'C') - s952163
i've changed the global MacOS settings, it doesn't help. regarding the local R settings, should i do it from F# interactive ? from a new R console ? i've done it in a R console but not sure it affects the current F# interactive session. - Fagui Curtain
you could put it inside .RProfile but I'm not sure if and how it will be read the by the R process. In case you tried setting the locale to US and it didn't help you, you might be right that there is some other issue. - s952163

1 Answers

2
votes

thanks to @s952163

it IS a regional setting problem. So if your global environment is in English you shouldn't have this bug.

Even though it's not a very satisfying answer, i will mark this as an answer for the time being.