Revision: 598 http://rpy.svn.sourceforge.net/rpy/?rev=598&view=rev Author: lgautier Date: 2008-07-27 14:44:27 +0000 (Sun, 27 Jul 2008)
Log Message: ----------- (Many) changes to the documentation (edition, additions). The documentation now refers to 2.0.0a2 (as the next alpha, possibly the last one, is getting closer). Modified Paths: -------------- branches/rpy_nextgen/doc/source/conf.py branches/rpy_nextgen/doc/source/index.rst branches/rpy_nextgen/doc/source/overview.rst branches/rpy_nextgen/doc/source/rinterface.rst branches/rpy_nextgen/doc/source/robjects.rst branches/rpy_nextgen/doc/source/rpy_classic.rst branches/rpy_nextgen/doc/source/rpy_logo_header.png Added Paths: ----------- branches/rpy_nextgen/doc/source/rlike.rst Modified: branches/rpy_nextgen/doc/source/conf.py =================================================================== --- branches/rpy_nextgen/doc/source/conf.py 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/conf.py 2008-07-27 14:44:27 UTC (rev 598) @@ -45,7 +45,7 @@ # The short X.Y version. version = '2.0' # The full version, including alpha/beta/rc tags. -release = '2.0a1' +release = '2.0.0a2' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: Modified: branches/rpy_nextgen/doc/source/index.rst =================================================================== --- branches/rpy_nextgen/doc/source/index.rst 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/index.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -31,10 +31,3 @@ changes -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - Modified: branches/rpy_nextgen/doc/source/overview.rst =================================================================== --- branches/rpy_nextgen/doc/source/overview.rst 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/overview.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -31,6 +31,8 @@ Naturally RPy2 is inspired by RPy, but also by A. Belopolskys's contributions that were waiting to be included into RPy. + + Installation ------------ @@ -48,15 +50,24 @@ on the `Sourceforge page <http://downloads.sourceforge.net/rpy>`_. .. note:: - MacOSX binaries may appear in the future (contributions to build them are welcome) + Choose files from the `rpy2` package, not `rpy`. +.. note:: + MacOSX binaries may appear in the future (contributions to build them are welcome) + +.. index:: + single: install;win32 + + Microsoft's Windows precompiled binaries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The executable can be ran; they will install the package in the default Python installation +The executable can be ran; it will install the package in the default Python installation on the system. +.. index:: + single: install;source Install from source ^^^^^^^^^^^^^^^^^^^ @@ -69,7 +80,25 @@ cd <rpy_package> python setup.py install +.. index:: + single: test;whole installation +Test an installation +^^^^^^^^^^^^^^^^^^^^ + +An installation can be tested as follows: + +.. code-block:: python + + import rpy2.tests + import unittest + + # the verbosity level can be increased if needed + tr = unittest.TextTestRunner(verbosity = 1) + suite = rpy2.tests.suite() + tr.run(suite) + + Contents -------- @@ -101,6 +130,15 @@ Design notes ------------ + +When designing ryp2, attention was given to make: + +- the use of the module simple from both a Python or R user's perspective + +- minimize the need for knowledge about R, and the need for tricks are workaround. +- the possibility to customize a lot only with Python (without having to go to C-level). + + :mod:`rpy2.robjects` implements an extension to the interface in :mod:`rpy2.rinterface` by extending the classes for R objects defined there with child classes. Modified: branches/rpy_nextgen/doc/source/rinterface.rst =================================================================== --- branches/rpy_nextgen/doc/source/rinterface.rst 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/rinterface.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -157,6 +157,17 @@ >>> .. index:: + single: Sexp; named + +:meth:`named` +--------------- + +`R` does not count references for its object. This method +returns the `NAMED` value (see the R-extensions manual). + + + +.. index:: single: SexpVector single: rinterface; SexpVector @@ -204,7 +215,7 @@ The *__getitem__* operator *[* is returning a Python scalar. Casting an *SexpVector* into a list is only a matter - either iterating through it, or simply calling + of either iterating through it, or simply calling the constructor :func:`list`. @@ -212,7 +223,7 @@ ----------------- .. index:: - single: names + single: names;rinterface Names ^^^^^ @@ -363,6 +374,28 @@ 6 >>> + +.. rubric:: Order for named parameters + +One point where function calls in R can differ from the ones in +Python is that +all parameters in R are passed in the order they are in the call +(no matter whether the parameter is named or not), +while in Python only parameters without a name are passed in order. +Using the class :class:`ArgsDict` in the module :mod:`rpy2.rlike.container` +permits calling a function the same way it would in R. For example:: + + import rpy2.rlike.container as rpc + args = rpc.ArgsDict() + args['x'] = rinterface.SexpVector([1,2,3], rinterface.INTSXP) + args[None] = rinterface.SexpVector([4,5], rinterface.INTSXP) + args['y'] = rinterface.SexpVector([6, ], rinterface.INTSXP) + rlist = rinterface.baseNameSpaceEnv['list'] + rl = rlist.rcall(args.items()) + +>>> [x for x in rl.do_slot("names")] +['x', '', 'y'] + closureEnv ---------- Added: branches/rpy_nextgen/doc/source/rlike.rst =================================================================== --- branches/rpy_nextgen/doc/source/rlike.rst (rev 0) +++ branches/rpy_nextgen/doc/source/rlike.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -0,0 +1,57 @@ +***** +rlike +***** + +.. module:: rpy2.rlike + :platform: Unix, Windows + :synopsis: Operate (a bit) like in R + + +Overview +======== + +The package proposes R features for a pure Python +context, that is without an embedded R running. + + + +Containers +========== +.. module:: rpy2.rlike.container + +>>> import rpy2.rlike.container as rlc + +ArgsDict +-------- + +The :class:`ArgsDict` proposes an implementation of what is +sometimes referred to in Python as an ordered dictionnary, with a +particularity: a key ``None`` means that, although an item has a rank +and can be retrieved from that rank, it has no "name". + +In the hope of simplifying its usage, the API for an ordered dictionnary +in :pep:`372` was implemented. An example of usage is: + +>>> x = (('a', 123), ('b', 456), ('c', 789)) +>>> nl = rlc.ArgsDict(x) + + +>>> nl['a'] +123 +>>> nl.index('a') +0 + +Not all elements have to be named, and specifying a key value equal +to `None` indicates a value for which no name is associated. + + +>>> nl[None] = 'no name' + + + +TaggedList +---------- + +A :class:`TaggedList` is a Python list in which each item has +an associated tag. +This is similar to `named` vectors in R. Modified: branches/rpy_nextgen/doc/source/robjects.rst =================================================================== --- branches/rpy_nextgen/doc/source/robjects.rst 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/robjects.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -28,7 +28,7 @@ Visible differences with RPy-1.x are: -- no CONVERSION mode in :mod:`rpy2`, the design has made this unnecessary +- no ``CONVERSION`` mode in :mod:`rpy2`, the design has made this unnecessary - easy to modify or rewrite with an all-Python implementation @@ -199,7 +199,22 @@ >>> x.r + 1 2:11 + +.. note:: + In Python, the operator ``+`` concatenate sequence object, and this behavior + has been conserved. + .. index:: + single: names; robjects + +Names +----- + +``R`` vectors can have a name given to all or some of the items. +The method :meth:`getnames` retrieve those names. + + +.. index:: pair: RVector; numpy Numpy @@ -408,7 +423,7 @@ Examples ======== -The following section demonstrates some of the features of +This section demonstrates some of the features of rpy2 by the example. The wiki on the sourceforge website will hopefully be used as a cookbook. @@ -431,6 +446,11 @@ kwargs = {'ylab':"foo/bar", 'type':"b", 'col':"blue", 'log':"x"} r.plot(x, y, **kwargs) +.. note:: + Since the named parameters are a Python :class:`dict`, + the order of the parameters is lost. Check :meth:`rpy2.rinterface.rcall` + to know how to keep the order of parameters. + Linear models ------------- Modified: branches/rpy_nextgen/doc/source/rpy_classic.rst =================================================================== --- branches/rpy_nextgen/doc/source/rpy_classic.rst 2008-07-27 14:31:56 UTC (rev 597) +++ branches/rpy_nextgen/doc/source/rpy_classic.rst 2008-07-27 14:44:27 UTC (rev 598) @@ -3,7 +3,7 @@ rpy_classic *********** -.. module:: rpy2.rpy_classix +.. module:: rpy2.rpy_classic :platform: Unix, Windows :synopsis: Emulate the orignal rpy 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 Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list