Revision: 498
          http://rpy.svn.sourceforge.net/rpy/?rev=498&view=rev
Author:   lgautier
Date:     2008-04-19 08:28:47 -0700 (Sat, 19 Apr 2008)

Log Message:
-----------
Updated the doc

Modified Paths:
--------------
    branches/rpy_nextgen/doc/rpy.texi

Modified: branches/rpy_nextgen/doc/rpy.texi
===================================================================
--- branches/rpy_nextgen/doc/rpy.texi   2008-04-19 15:28:30 UTC (rev 497)
+++ branches/rpy_nextgen/doc/rpy.texi   2008-04-19 15:28:47 UTC (rev 498)
@@ -148,7 +148,8 @@
 the @uref{http://www.omegahat.org/RSPython, Omegahat project}.
 
 @RPy2{} is inspired by @RPy{} and A. Belopolskys's contributions to @RPy.
-Backward compatibility with @RPy{} is limited.
+Backward compatibility with @RPy{} is somewhat limited, but rinterface
+is providing the basic blocks to re-implement @RPy{} if needed. 
 
 FIXME: write a section about what changed
 
@@ -157,12 +158,13 @@
 The package is made of several elements:
 @table @code
 @item robjects
-Higher-level interface, for when ease-of-use matters most
+Higher-level interface, when ease-of-use matters most
 (@xref{robjects})
 
 @item rinterface
-How-level interface to R, for when speed and flexibility
-matter most (@xref{rinterface})
+Low-level interface to R, when speed and flexibility
+matter most (@xref{rinterface}). Here the programmer gets close
+to @R{}'s C API, and can use R's function faster than within an R session.
 
 @end table
 
@@ -429,12 +431,25 @@
 
 Methods:
 @table @code
[EMAIL PROTECTED] typeof()
+Type of the object
 @item do_slot([name])
 Access attribute @code{name} for the object
[EMAIL PROTECTED] typeof()
-Type of the object
 @end table
 
[EMAIL PROTECTED] typeof
[EMAIL PROTECTED] typeof
+
+The internal @R{} type in which an object is stored can be
+accessed with the function @code{typeof}.
+
[EMAIL PROTECTED]
+>>> letters.typeof()
[EMAIL PROTECTED] example
+
+FIXME: talk about the all the types.
+
+
 @node do_slot
 @subsection do_slot
 
@@ -452,10 +467,14 @@
 @end example
 
 
+
 @node SexpVector
 @section SexpVector
 
[EMAIL PROTECTED] Overview
 In @R{} all scalars are in fact vectors.
+Anything like a one-value variable is a vector of
+length 1.
 
 To use again the constant @code{pi}:
 @example
@@ -468,6 +487,12 @@
 3.1415926535897931
 @end example
 
+Important note: The @code{__getitem__} operator @code{[}
+is returning a @Python{} scalar. Because of that casting
+an @code{SexpVector} into a list is only a matter of calling
+the constructor @code{list}.
+
+The letters of the (western) alphabet are:
 @example
 >>> letters = rinterface.globalEnv.get("letters") 
 >>> len(letters)
@@ -475,7 +500,11 @@
 >>> LETTERS = rinterface.globalEnv.get("LETTERS") 
 @end example
 
-
[EMAIL PROTECTED] Names
+In @R{}, vectors can be named, that is each value in the vector
+can be given a name (that is be associated a string).
+The names are added to the other as an attribute (conveniently
+called names), and can be accessed as such:
 @example
 >>> options = rinterface.globalEnv.get("options")()
 >>> option_names = options.do_slot("names")
@@ -483,7 +512,27 @@
 @end example
 (to know more about @code{do_slot}, @xref{do_slot}).
 
[EMAIL PROTECTED] Numeric, numarray, numpy (and future possible names)
 
+The SexpVector objects are made to behave like arrays as defined
+in the @Python{} packages Numeric, numarray, and numpy.
+
+The functions @code{array} and @code{asarray} is all that is needed:
[EMAIL PROTECTED]
+>>> import Numeric
+>>> rx = rinterface.SexpVector([1,2,3,4], rinterface.INTSXP)
+>>> nx = Numeric.array(rx)
+>>> nx_nc = Numeric.asarray(rx)
[EMAIL PROTECTED] example
+
+Important note: when using @code{asarray}, the data are not copied.
[EMAIL PROTECTED]
+>>> nx_nc[2] = 42
+>>> rx[2]
+42
[EMAIL PROTECTED] example
+
+
 @node SexpEnvironment
 @section SexpEnvironment
 
@@ -501,7 +550,7 @@
 is by default in the search path.
 
 
[EMAIL PROTECTED] __getitem__, __setitem__
[EMAIL PROTECTED] __getitem__ / __setitem__
 
 The @code{[} operator will only look for a symbol in the environment
 (FIXME: first in the list then ?),
@@ -522,13 +571,37 @@
 @end example
 note: a copy of the @R{} object is made in the @R{} space.
 
[EMAIL PROTECTED] __iter__
 
+The object is made iter-able.
+
+For example, we take the base name space (that is the environment
+that contains @R{}'s base objects:
[EMAIL PROTECTED]
+>>> base = rinterface.baseNameSpace
+>>> basetypes = [x.typeof() for x in base]
[EMAIL PROTECTED] example
+
+Note that in the current implementation the content of the environment
+is evaluated only once, when the iterator is created, and that adding 
+or removing elements to the environment after will not have any effect.
+
 @node SexpClosure
 @section SexpClosure
 
[EMAIL PROTECTED] A function with a context
 In @R{} terminology, a closure is a function (with its enclosing
-environment).
+environment). That enclosing environment can be thought of as
+a context to the function.
 
[EMAIL PROTECTED]
+>>> sum = rinterface.globalEnv.get("sum")
+>>> x = rinterface.SexpVector([1,2,3], rinterface.INTSXP)
+>>> s = sum(x)
+>>> s[0]
+6
[EMAIL PROTECTED] example
+
 @subsection closureEnv
 
 In the example below, we inspect the environment for the


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to