ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 12 Apr 2012 03:22:23 +0200Add R package in Sage folderhttps://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/Hi,
Simple question (I think) but have not found anything. I want to add package in R like GGPLOT2 and use it in IDE/command line for sage (not note book). I am using Ubuntu Lucid and have r working on its own.
So.
1. Is it better to use the R in the Sage folder and add packages to that folder? If so how, as in Ubuntu everything goes to the main R installation.
2. Or is there an easy way to just point RPy to the main R installation when using SAGE. Wed, 11 Apr 2012 02:47:52 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/Answer by kcrisman for <p>Hi,</p>
<p>Simple question (I think) but have not found anything. I want to add package in R like GGPLOT2 and use it in IDE/command line for sage (not note book). I am using Ubuntu Lucid and have r working on its own. </p>
<p>So.</p>
<ol>
<li><p>Is it better to use the R in the Sage folder and add packages to that folder? If so how, as in Ubuntu everything goes to the main R installation. </p></li>
<li><p>Or is there an easy way to just point RPy to the main R installation when using SAGE. </p></li>
</ol>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=13445#post-id-13445Not sure why Niles thinks you need to do this... this was built in early on by the Sage-R interface.
sage: r.install_packages('ggplot2')
I've even done this live in talks I've given. Naturally, make sure you have an internet connection and that the package you want is supported by the version of R in Sage.Wed, 11 Apr 2012 14:15:26 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=13445#post-id-13445Comment by niles for <p>Not sure why Niles thinks you need to do this... this was built in early on by the Sage-R interface.</p>
<pre><code>sage: r.install_packages('ggplot2')
</code></pre>
<p>I've even done this live in talks I've given. Naturally, make sure you have an internet connection and that the package you want is supported by the version of R in Sage.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19958#post-id-19958Ha! Because Niles isn't really familiar with R -- sorry for the confusion.Wed, 11 Apr 2012 14:38:38 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19958#post-id-19958Answer by niles for <p>Hi,</p>
<p>Simple question (I think) but have not found anything. I want to add package in R like GGPLOT2 and use it in IDE/command line for sage (not note book). I am using Ubuntu Lucid and have r working on its own. </p>
<p>So.</p>
<ol>
<li><p>Is it better to use the R in the Sage folder and add packages to that folder? If so how, as in Ubuntu everything goes to the main R installation. </p></li>
<li><p>Or is there an easy way to just point RPy to the main R installation when using SAGE. </p></li>
</ol>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=13447#post-id-13447You could switch to a shell with the same environment variable settings that Sage uses. `sage -sh` starts such a shell for you, and then package installation might work on sage's copy of R instead of the system copy. More details are described for a similar question here:
http://ask.sagemath.org/question/1252/using-psycopg2-and-other-libraries-in-sageWed, 11 Apr 2012 10:15:34 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=13447#post-id-13447Comment by mcm3 for <p>You could switch to a shell with the same environment variable settings that Sage uses. <code>sage -sh</code> starts such a shell for you, and then package installation might work on sage's copy of R instead of the system copy. More details are described for a similar question here:</p>
<p><a href="http://ask.sagemath.org/question/1252/using-psycopg2-and-other-libraries-in-sage">http://ask.sagemath.org/question/1252...</a></p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19948#post-id-19948OK after reinstalling using sage -f r this works for 1. sage -sh 2. sage - R 3. install.packages('orloca'). Thanks for all the help.
Thu, 12 Apr 2012 03:02:48 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19948#post-id-19948Comment by kcrisman for <p>You could switch to a shell with the same environment variable settings that Sage uses. <code>sage -sh</code> starts such a shell for you, and then package installation might work on sage's copy of R instead of the system copy. More details are described for a similar question here:</p>
<p><a href="http://ask.sagemath.org/question/1252/using-psycopg2-and-other-libraries-in-sage">http://ask.sagemath.org/question/1252...</a></p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19957#post-id-19957This definitely should work. I'm putting yet another way of thinking of this below.Wed, 11 Apr 2012 15:00:02 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19957#post-id-19957Answer by kcrisman for <p>Hi,</p>
<p>Simple question (I think) but have not found anything. I want to add package in R like GGPLOT2 and use it in IDE/command line for sage (not note book). I am using Ubuntu Lucid and have r working on its own. </p>
<p>So.</p>
<ol>
<li><p>Is it better to use the R in the Sage folder and add packages to that folder? If so how, as in Ubuntu everything goes to the main R installation. </p></li>
<li><p>Or is there an easy way to just point RPy to the main R installation when using SAGE. </p></li>
</ol>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=12146#post-id-12146Or you could do
$ sage -R
<snip lots of stuff>
> install.packages('orloca')
and you will probably get some popup or some menu about choosing a CRAN mirror.Wed, 11 Apr 2012 15:01:27 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?answer=12146#post-id-12146Comment by mcm3 for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19947#post-id-19947OK the sage -f r did the job thanks.Thu, 12 Apr 2012 03:22:23 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19947#post-id-19947Comment by mcm3 for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19953#post-id-19953This is some output FYI. matthew@matthew-laptop:~$ sage -R
Error in if (file.info(codeFile)["size"] == file.info(loaderFile)["size"]) warning("package seems to be using lazy loading already") else { :
missing value where TRUE/FALSE needed
ERROR: lazy loading failed for package proto
* removing /opt/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/R/library/proto
ERROR: dependency plyr is not available for package stringr
* removing /opt/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/R/library/stringr
ERROR: dependency colorspace is not available for package munsell
* removing /opt/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/R/library/munsell
ERROR: dependency digest is not available for package memoise
* removing /opt/sage-4.8-liWed, 11 Apr 2012 16:55:07 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19953#post-id-19953Comment by mcm3 for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19954#post-id-19954This almost works but has not installed anything correctly yet. I have tried orloca, ggplot2, and maptools so far. I will put a big list of output below just FYI. Systems info: Sage 4.7, ubuntu lucid. Other aspects of SAGE are working fine for me. Wed, 11 Apr 2012 16:53:28 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19954#post-id-19954Comment by kcrisman for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19950#post-id-19950Or you could just build Sage from scratch :)Wed, 11 Apr 2012 22:54:06 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19950#post-id-19950Comment by kcrisman for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19951#post-id-19951Hmm, that is puzzling. What happens if you use the "within Sage" option? I think that at least part of the problem is that there are some "hardcoded" parts - see the `wstein` bits, that shouldn't be there. If it persists, I would try doing `sage -f r`, assuming you have the right dependencies like fortran on your system, and then doing all of this again. Wed, 11 Apr 2012 22:53:57 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19951#post-id-19951Comment by mcm3 for <p>Or you could do</p>
<pre><code>$ sage -R
<snip lots of stuff>
> install.packages('orloca')
</code></pre>
<p>and you will probably get some popup or some menu about choosing a CRAN mirror.</p>
https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19952#post-id-19952for maptools error looks like thismake: /home/wstein/build/sage-4.8/local/lib/R/share/make/shlib.mk: No such file or directory
make: *** No rule to make target `/home/wstein/build/sage-4.8/local/lib/R/share/make/shlib.mk'. Stop.
ERROR: compilation failed for package sp
* removing /opt/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/R/library/sp
ERROR: dependency sp is not available for package maptools
* removing /opt/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/R/library/maptools
The downloaded packages are in
/tmp/RtmpzrpYpN/downloaded_packages
Warning messages:
1: In install.packages("maptools") :
installation of package sp had non-zero exit status
2: In install.packages("maptools") :
installation of package maptools had non-zero exit statWed, 11 Apr 2012 16:57:37 +0200https://ask.sagemath.org/question/8870/add-r-package-in-sage-folder/?comment=19952#post-id-19952