Search code examples
rsmalltalk

Calling R from within Smalltalk?


Is there any package for calling R from Smalltalk code and accessing return values? Any example script? I'm not looking any particular R functionality, just exploring possibility.

Any Smalltalk flavor would be ok.


Solution

  • In Pharo 4.0 there is a project named RProjectConnector which connects to your locally installed R system.

    If you are using Windows first you should copy your R library files evaluating the following script:

    | rPath dlls |
    (rPath := WinRegistry
        queryValue: 'InstallPath'
        fromKey: (WinRegistryKey localMachine queryOpenSubkey: 'Software\\R-core\\R')) notNil
            ifTrue: [
                dlls := (rPath asFileReference / 'bin' / 'i386') entries
                        select: [ : entry | entry  extension = 'dll' ]
                        thenDo: [ : dllEntry | 
                            dllEntry asFileReference
                                copyTo: Smalltalk vmDirectory asFileReference / dllEntry basename ] ].
    

    If you are using another not-Ubuntu Linux try to install R 32-bit (it could be a mess).

    And finally follow install instructions