Ray Doyle
Ray Doyle

Reputation: 849

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.

Upvotes: 2

Views: 271

Answers (2)

Hernán
Hernán

Reputation: 1749

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

Upvotes: 1

Mariano Martinez Peck
Mariano Martinez Peck

Reputation: 661

I don't know anything, but of course, in all Smalltalk dialects, you have a FFI plugin where you can talk to any external C-based library, like R in this case. mmmmm I guess R is in C...

Check for example: http://book.pharo-project.org/book/PharoTools/FFI/

Upvotes: 0

Related Questions