Hi, I've search on http://rpy.sourceforge.net/ and use R with commands inside a Sage script as following:
from sage.all import * def iunif(a,b): return Integer(fround(r.runif(1,RDF(a),RDF(b)),0)) def runif(a,b,prec): return RDF(fround(r.runif(1,RDF(a),RDF(b)),prec)) def rbernoulli(): return r.rbinom(1, 1, 0.5)._sage_() >From Sage I've used RDF because R needs "reals" and not symbolic expressions and used _sage_() to convert from R objects to Sage objects. I have problems with: r.set_seed => accept only one argument r graphics => could not got them to appear in Sage environment. I'm no expert in Sage so I welcome any suggestion to improve the above commands. Pedro Cruz On Jan 29, 4:02 am, Gokhan Sever <gokhanse...@gmail.com> wrote: > On Jan 28, 8:00 pm, Ondrej Certik <ond...@certik.cz> wrote: > > > Hi, > > > are there some examples how to use R from Sage? > > > I tried to search here: > > >http://www.sagemath.org/help.html > > >http://www.sagemath.org/doc/reference/ > > > I also tried to search sage-devel, for "R" and "R statistics" and "R > > statistical", but didn't find anything. So the next time, I'll at > > least find my own message, and hopefully some hints. :) > > > Ondrej > > Hi Ondrej, > > A couple sources I can point out: > > http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.interfa... > (Interestingly this doesn't show up on the main reference > --http://www.sagemath.org/doc/reference/interfaces.html) > Might need to let SAGE guys know about this, on sage-devel or open a > documentation enhancement etc. :) > > http://groups.google.com/group/sage-support/browse_thread/thread/53d6... > > Also sage-notebook has an "r" mode you can directly enter "R" > commands. > > y <- c(1, 2, 3) instead of y = r("c(1, 2, 3)") > > I know it is tricky to search terms like "R" or "C". Python is very > easy to find although at time it interferes with the snake and > monthy :) On Jan 29, 4:02 am, Gokhan Sever <gokhanse...@gmail.com> wrote: > On Jan 28, 8:00 pm, Ondrej Certik <ond...@certik.cz> wrote: > > > Hi, > > > are there some examples how to use R from Sage? > > > I tried to search here: > > >http://www.sagemath.org/help.html > > >http://www.sagemath.org/doc/reference/ > > > I also tried to search sage-devel, for "R" and "R statistics" and "R > > statistical", but didn't find anything. So the next time, I'll at > > least find my own message, and hopefully some hints. :) > > > Ondrej > > Hi Ondrej, > > A couple sources I can point out: > > http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.interfa... > (Interestingly this doesn't show up on the main reference > --http://www.sagemath.org/doc/reference/interfaces.html) > Might need to let SAGE guys know about this, on sage-devel or open a > documentation enhancement etc. :) > > http://groups.google.com/group/sage-support/browse_thread/thread/53d6... > > Also sage-notebook has an "r" mode you can directly enter "R" > commands. > > y <- c(1, 2, 3) instead of y = r("c(1, 2, 3)") > > I know it is tricky to search terms like "R" or "C". Python is very > easy to find although at time it interferes with the snake and > monthy :) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org