http://github.com/jolby/rincanter
Rincanter is a Clojure/Incanter wrapper around the rosuda JRIEngine
Java/R bridge. The hope is to allow easy access to an embedded R
engine from Incanter. It also offers translation between Clojure/
Incanter datatypes and R datatypes such as R dataframe to Incanter
dataset. My original intent was mainly to allow a fairly easy way to
access most of the huge number of R datasets from Incanter. I think it
has gotten to the point where it can start to do that. It also allows
fairly easy meshing of the two within one REPL session, which can be
pretty fun:
;;example session
(with-r-eval
"data(iris)"
;;eval's the iris dataframe object, converts into
;;incanter dataset
"iris"
;;create vector on R side
"vec_in_r = c(1,2,3)"
;;now retrieve it, converting to Clojure vector
(r-get "vec_in_r"))
=> [1.0 2.0 3.0]
Anyhow, its still a little rough, but starting to be usable. Any
suggestions for further directions, patches, etc are welcome.
Cheers,
Joel Boehland
David
--Joel
The bumps:
only make (not configure && make) is needed under both the REngine and
REngine/JRI directories
The roadblock:
~/java $ git clone g...@github.com:jolby/rincanter.git
Initialized empty Git repository in /home/walt/java/rincanter/.git/
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
So close but no cigar! :-)
I'm excited by the prospect of exploring your work.
git clone git://github.com/jolby/rincanter.git
David
Thanks David. That worked.
Also a belated thanks for Incanter. I'd love to be able to contribute
at some point down the road.
Walt
--Joel
I didnt manage to install JRI and REngine sucessfully.
However, from http://www.rforge.net/JRI/files/,
I got a copy of JRIEngine.jar and REngine.jar
and from the already installed R package rJava (rJava\jri), I got
jri.dll
(I am on Windows Vista 64-bit.)
By any chance, are these suitable substitutes?
i.e. I put rJava\jri\jri.dll into rincanter and
JRIEngine.jar/REngine.jar from http://www.rforge.net/JRI/files/
into rincanter\lib.
Following the remaining instructions in http://github.com/jolby/rincanter,
why do I need to install incanter from git, when
"cd rincanter
lein deps "
installs incanter and its deps into the rincanter/lib subdir?
i.e. doesnt rincanter have everything it needs inside the lib
subdirectory?
Assuming I do still need to install incanter from git, after cloning
it,
what do I have to do to make rincanter pick up that newly downloaded
version of incanter?
e.g. I have reset INCANTER_HOME to point to the newly installed
incanter from githib
INCANTER_HOME=E:\keep\eclipse\3.5\git-rincanter\src\incanter
and prepended to the front of CLASSPATH to pick up the jars in
rincanter\lib
CLASSPATH=E:\keep\eclipse\3.5\git-rincanter\src\rincanter\lib;E:\etc
\clojure\clojure;E:\opt\jars
but when I try "lein test", I get the following error.
E:\keep\eclipse\3.5\git-rincanter\src\rincanter>lein test
...
[null] Caused by: java.lang.Exception: No such var: clojure.test/
successful?
[null] at clojure.lang.Compiler.resolveIn(Compiler.java:4773)
[null] at clojure.lang.Compiler.resolve(Compiler.java:4743)
[null] at clojure.lang.Compiler.analyzeSymbol(Compiler.java:4720)
[null] at clojure.lang.Compiler.analyze(Compiler.java:4387)
[null] ... 70 more
I guess that I have taken too many shortcuts
and need to get JRI and REngine to compile from scratch
but any pointers about the flaws in my logic above might be helpful.
Regards,
John.
On Jan 29, 11:50 pm, jolby <jboehl...@gmail.com> wrote:
> Hello,
> I would like to announce my little project I've been working on up at
> github,Rincanter.
>
> http://github.com/jolby/rincanter
>
> Rincanteris a Clojure/Incanter wrapper around the rosuda JRIEngine
I can answer this part of the question, you need to install Incanter
using 'mvn install' so that it is available to 'lein deps'. The
version of Incanter available on a public repository is out of date
(something I'm trying to remedy), so it needs to be installed locally.
>
> Assuming I do still need to install incanter from git, after cloning
> it,
> what do I have to do to make rincanter pick up that newly downloaded
> version of incanter?
You shouldn't have to do anything, Leiningen will take care of it.
As far as INCANTER_HOME is concerned, right now its only purpose is to
point to the example data I include in the distribution that you can
access with incanter.datasets/get-dataset function. If it isn't set,
get-dataset downloads the data from Github, so I wouldn't worrying
about setting it.
I'll have to leave it to Joel to address to rest of your questions.
Good luck,
David
As for your first question, I *think* that getting the
JRIEngine/REngine jars into yor project's lib/ dir, and putting the
jri.dll into the project's root dir should work. It would be worth
giving it a shot since you already have those installed locally. Give
it a try, and if you encounter any errors, let me know.
As for your question about the requirement for installing incanter
from git- that is because I am relying on some fairly recent changes.
Oh- I see that David has answered this part, so basically, what he
said :-)
Cheers,
Joel
Following the instructions at http://github.com/jolby/rincanter, I
have a problem with the command:
lein deps
which gives me the following output:
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.pom from central
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.pom from clojure
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.pom from clojure-snapshots
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.pom from clojars
Downloading: org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-
alpha-SNAPSHOT.pom from clojure
Downloading: org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-
alpha-SNAPSHOT.pom from clojure-snapshots
Downloading: org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-
alpha-SNAPSHOT.pom from clojars
Downloading: org/clojure/clojure/1.1.0-alpha-SNAPSHOT/clojure-1.1.0-
alpha-SNAPSHOT.pom from central
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.pom from
clojure
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.pom from
clojure-snapshots
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.pom from
clojars
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.pom from
central
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.jar from central
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.jar from clojure
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.jar from clojure-snapshots
Downloading: incanter/incanter-app/1.0-master-SNAPSHOT/incanter-
app-1.0-master-SNAPSHOT.jar from clojars
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.jar from
clojure
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.jar from
clojure-snapshots
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.jar from
clojars
Downloading: org/clojure/swank-clojure/1.0/swank-clojure-1.0.jar from
central
[null] An error has occurred while processing the Maven artifact
tasks.
[null] Diagnosis:
[null]
[null] Unable to resolve artifact: Missing:
[null] ----------
[null] 1) incanter:incanter-app:jar:1.0-master-SNAPSHOT
[null]
[null] Try downloading the file manually from the project
website.
[null]
[null] Then, install it using the command:
[null] mvn install:install-file -DgroupId=incanter -
DartifactId=incanter-app -Dversion=1.0-master-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file
[null]
[null] Alternatively, if you host your own repository you can
deploy the file there:
[null] mvn deploy:deploy-file -DgroupId=incanter -
DartifactId=incanter-app -Dversion=1.0-master-SNAPSHOT -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[null]
[null] Path to dependency:
[null] 1) org.apache.maven:super-pom:jar:2.0
[null] 2) incanter:incanter-app:jar:1.0-master-SNAPSHOT
[null]
[null] 2) org.clojure:swank-clojure:jar:1.0
[null]
[null] Try downloading the file manually from the project
website.
[null]
[null] Then, install it using the command:
[null] mvn install:install-file -DgroupId=org.clojure -
DartifactId=swank-clojure -Dversion=1.0 -Dpackaging=jar -Dfile=/path/
to/file
[null]
[null] Alternatively, if you host your own repository you can
deploy the file there:
[null] mvn deploy:deploy-file -DgroupId=org.clojure -
DartifactId=swank-clojure -Dversion=1.0 -Dpackaging=jar -Dfile=/path/
to/file -Durl=[url] -DrepositoryId=[id]
[null]
[null] Path to dependency:
[null] 1) org.apache.maven:super-pom:jar:2.0
[null] 2) leiningen:lein-swank:jar:1.0.0-SNAPSHOT
[null] 3) org.clojure:swank-clojure:jar:1.0
[null]
[null] ----------
[null] 2 required artifacts are missing.
[null]
[null] for artifact:
[null] org.apache.maven:super-pom:jar:2.0
[null]
[null] from the specified remote repositories:
[null] central (http://repo1.maven.org/maven2),
[null] clojars (http://clojars.org/repo/),
[null] clojure-snapshots (http://build.clojure.org/snapshots),
[null] clojure (http://build.clojure.org/releases)
[null]
[null]
This is my first time using incanter and I'm still pretty new to
clojure. I don't have a grasp on what's going wrong here. Any ideas
at all will be helpful.
ronny
ronny at "Tue, 23 Mar 2010 11:30:34 -0700 (PDT)" wrote:
r> Joel, thank you for your work on this - I've been using R regularly
r> for a while now and recently started digging into clojure. This will
r> make the transition very nice.
r> Following the instructions at http://github.com/jolby/rincanter, I
r> have a problem with the command:
r> lein deps
r> which gives me the following output:
you need to add following code to project.clj
:repositories {"incanter" "http://repo.incanter.org"})
--
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/ http://alexott.net/
http://alexott-ru.blogspot.com/
--Joel
> To unsubscribe from this group, send email to incanter+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>
In addition to adding the repository, you'll need to update the
version of Incanter to at least 1.0.0:
[org.incanter/incanter-full "1.0.0"]
or
[org.incanter/incanter-full "1.2.0-SNAPSHOT"]
and you might need to update the lein-swank dependency too:
[swank-clojure "1.1.0"]
David
--Joel
I pulled the new version of rincanter and flew past the "lein deps"
command. After copying over the .jar and native jri libraries, and
exporting R_HOME from .bash_profile, I call "lein test" and the
program appears to complete the tests:
$ lein test
[null] Testing com.evocomputing.test.rincanter
[null] Ran 10 tests containing 21 assertions.
[null] 0 failures, 0 errors.
[null] --------------------
[null] Total:
[null] Ran 10 tests containing 21 assertions.
[null] 0 failures, 0 errors.
but then hangs. Assuming it's not too critical to complete the tests,
I Ctrl-C to move on and get started with rincanter, which doesn't
recognize the r-eval command when I call "lein repl" from a
terminal:
$ lein repl
Warning: the repl task currently doesn't honor some project.clj
options due to I/O stream issues. Future versions will address
this, but for now you will get more consistent behaviour from repls
launched by either the lein-swank plugin or the lein-nailgun plugin.
Clojure 1.1.0
user=> (r-eval "vec_in_r = c(1,2,3)")
java.lang.Exception: Unable to resolve symbol: r-eval in this context
(NO_SOURCE_FILE:1)
I'm not sure if this makes a difference, but if I just start a repl
from the same directory, (with "clj"), I'm using the recently
installed version of clojure:
$ clj
Clojure 1.2.0-master-SNAPSHOT
user=> (r-eval "vec_in_r = c(1, 2, 3)")
java.lang.Exception: Unable to resolve symbol: r-eval in this context
(NO_SOURCE_FILE:1)
I'm going to try to track down why rincanter calls the older version
of clj, but I'm not sure if that's going to be helpful or not.
ronny
On Mar 23, 1:26 pm, Joel Boehland <jboehl...@gmail.com> wrote:
> Ok, thanks for pointing this out. Making these changes right now.
>
> --Joel
>
> On Tue, Mar 23, 2010 at 12:20 PM, David Edgar Liebke <lie...@gmail.com> wrote:
>
>
>
> > Joel,
>
> > In addition to adding the repository, you'll need to update the
> > version of Incanter to at least 1.0.0:
>
> > [org.incanter/incanter-full "1.0.0"]
> > or
> > [org.incanter/incanter-full "1.2.0-SNAPSHOT"]
>
> > and you might need to update the lein-swank dependency too:
> > [swank-clojure "1.1.0"]
>
> > David
>
> > On Tue, Mar 23, 2010 at 3:11 PM, Joel Boehland <jboehl...@gmail.com> wrote:
> >> Sorry about this guys- I've sort of letRincanterfall on the back
> >> burner. I'll add Alex Ott's fix and commit shortly. Thanks for
> >> pointing this out.
>
> >> --Joel
>
> >> On Tue, Mar 23, 2010 at 12:05 PM, Alex Ott <alex...@gmail.com> wrote:
> >>> Hello
>
> >>> ronny at "Tue, 23 Mar 2010 11:30:34 -0700 (PDT)" wrote:
> >>> r> Joel, thank you for your work on this - I've been using R regularly
> >>> r> for a while now and recently started digging into clojure. This will
> >>> r> make the transition very nice.
>
> >>> r> Following the instructions athttp://github.com/jolby/rincanter, I
I think you just need to use the rincanter package to get going, I'll
update the docs so that is clear. Try this:
lein repl
user=> (use '(com.evocomputing rincanter))
nil
user=> (r-eval "vec_in_r = c(1,2,3)")
[1.0 2.0 3.0]
I also noticed that the tests hang after running. I'm not sure what
the cause is of that yet.
Let me know if you have any more questions/problems.
--Joel
I sincerely appreciate your help.
ronny
On Mar 23, 4:22 pm, Joel Boehland <jboehl...@gmail.com> wrote:
> Hi Ronny,
> You're very close, and I'm sorry for how rough the setup is on this
> package- obviouslyRincanterisn't very polished yet.
>
> I think you just need to use therincanterpackage to get going, I'll
> update the docs so that is clear. Try this:
>
> lein repl
> user=> (use '(com.evocomputingrincanter))
> nil
> user=> (r-eval "vec_in_r = c(1,2,3)")
> [1.0 2.0 3.0]
>
> I also noticed that the tests hang after running. I'm not sure what
> the cause is of that yet.
>
> Let me know if you have any more questions/problems.
>
> --Joel
>
>
>
> On Tue, Mar 23, 2010 at 2:30 PM, ronny <rbjarna...@gmail.com> wrote:
> > Joel, David and Alex - thanks for your help.
>
> > I pulled the new version ofrincanterand flew past the "lein deps"
> > command. After copying over the .jar and native jri libraries, and
> > exporting R_HOME from .bash_profile, I call "lein test" and the
> > program appears to complete the tests:
>
> > $ lein test
> > [null] Testing com.evocomputing.test.rincanter
> > [null] Ran 10 tests containing 21 assertions.
> > [null] 0 failures, 0 errors.
> > [null] --------------------
> > [null] Total:
> > [null] Ran 10 tests containing 21 assertions.
> > [null] 0 failures, 0 errors.
>
> > but then hangs. Assuming it's not too critical to complete the tests,
> > I Ctrl-C to move on and get started withrincanter, which doesn't
> > recognize the r-eval command when I call "lein repl" from a
> > terminal:
>
> > $ lein repl
> > Warning: the repl task currently doesn't honor some project.clj
> > options due to I/O stream issues. Future versions will address
> > this, but for now you will get more consistent behaviour from repls
> > launched by either the lein-swank plugin or the lein-nailgun plugin.
>
> > Clojure 1.1.0
> > user=> (r-eval "vec_in_r = c(1,2,3)")
> > java.lang.Exception: Unable to resolve symbol: r-eval in this context
> > (NO_SOURCE_FILE:1)
>
> > I'm not sure if this makes a difference, but if I just start a repl
> > from the same directory, (with "clj"), I'm using the recently
> > installed version of clojure:
>
> > $ clj
> > Clojure 1.2.0-master-SNAPSHOT
> > user=> (r-eval "vec_in_r = c(1, 2, 3)")
> > java.lang.Exception: Unable to resolve symbol: r-eval in this context
> > (NO_SOURCE_FILE:1)
>
> > I'm going to try to track down whyrincantercalls the older version