Revision: 790 http://rpy.svn.sourceforge.net/rpy/?rev=790&view=rev Author: lgautier Date: 2010-11-01 06:42:28 +0000 (Mon, 01 Nov 2010)
Log Message: ----------- news entries + edited layout for the website Modified Paths: -------------- trunk/htdocs/news.data trunk/htdocs/templates/base.html trunk/htdocs/templates/rpy_documentation.html trunk/htdocs/templates/rpy_download.html Modified: trunk/htdocs/news.data =================================================================== --- trunk/htdocs/news.data 2010-10-17 18:25:48 UTC (rev 789) +++ trunk/htdocs/news.data 2010-11-01 06:42:28 UTC (rev 790) @@ -1,4 +1,99 @@ <!-- title: News --> +title: Calling Python functions from R +date: 2010-10-31 + +<p> +Among the new features in the upcoming version 2.2.0, there is +the possibility to write in Python the functions to be passed to higher-order +R functions. In other words, it is becoming possible to write a Python +function and expose it to R in such a way that the embedded R engine +can call it. +</p> + +<p> +As an example, let's consider the R function +<i>optim()</i> that looks for optimal parameters for a given cost function. +The cost function should be passed in the call to <i>optim()</i> as it will be +repeatedly called as the parameter space is explored, and it is now possible +to write that cost function in Python, as the code below demonstrates it. +</p> + +<pre> +from rpy2.robjects.vectors import FloatVector +from rpy2.robjects.packages import importr +import rpy2.rinterface as ri +stats = importr('stats') + +# Rosenbrock Banana function as a cost function +# (as in the R man page for optim()) +def cost_f(x): + x1 = x[0] + x2 = x[1] + return 100 * (x2 - x1 * x1)**2 + (1 - x1)**2 + +# wrap the function f so it can be exposed to R +cost_fr = ri.rternalize(cost_f) + +# starting parameters +start_params = FloatVector((-1.2, 1)) + +# call R's optim() +res = stats.optim(start_params, cost_fr) +</pre> + +<p> +The example is working verbatim with today's snapshot of the code repository +(branch version_2.2.x), although few modifications might be needed in the +future. Although this is development code and version 2.2.0 is scheduled +to be released some time next year, the +<a href="http://rpy.sourceforge.net/rpy2/doc-2.2/html/rinterface.html#calling-python-functions-from-r">documentation already outlines this feature</a>. +Early testing is welcome, and issues can be reported on the +<a href="http://bitbucket.org/lgautier/rpy2/issues/">bitbucket tracker</a>. +</p> + +<!-- title: News --> +title: Release 2.1.7 +date: 2010-10-18 + +<p> +After a very short-lived release 2.1.6, +a new bugfix release for the 2.1.x series is out. +It should definitely fix the build/install issues when libraries +are in least expected locations. +</p> + + +<!-- title: News --> +title: R <i>external pointer</i> +date: 2010-10-03 + +<p> +In R handling data structures in a foreign language (read C/C++) +is done through an <i>external pointer</i>. Those +pointer do not obey the pass-by-value rule and are +not copied. +</p> + +<p> +The version 2.2.x has a new class <i>rpy2.rinterface.SexpExtPtr</i> +to represent those objects. With this, handling from Python such C-level constructs +understood by some R packages, using for example <i>ctypes</i>, +becomes possible. Further use of this for calling +back Python functions from R within the rpy2 system will be tried in the future. +</p> + +<!-- title: News --> +title: Release 2.1.5 +date: 2010-09-27 + +<p> +Bugfix release for the 2.1.x series. It only fixes (some of) the +issues when building/installing while R libraries are in lesser +expected places. +</p> + + +<!-- title: News --> title: Reflection on R S4 classes date: 2010-09-12 @@ -12,6 +107,7 @@ R can be exposed as a corresponding Python class, with that Python class defined on the fly from the R class definition. Although this is still under development, there is already <a href="http://rpy.sourceforge.net/rpy2/doc-2.2/html/robjects_oop.html#automated-r-in-python-class-definitions">documentation for how to use it.</a> +</p> <!-- title: News --> title: rpy2 and Python3 Modified: trunk/htdocs/templates/base.html =================================================================== --- trunk/htdocs/templates/base.html 2010-10-17 18:25:48 UTC (rev 789) +++ trunk/htdocs/templates/base.html 2010-11-01 06:42:28 UTC (rev 790) @@ -48,13 +48,9 @@ <ul class="menu"> <li><a href="rpy.html">About</a></li> <li><a href="rpy_bugs.html">Bugs</a></li> - <li><a href="rpy_svn.html">Code repository</a></li> - <li><a href="rpy_download.html">Download</a></li> <li><a href="rpy_documentation.html">Documentation</a></li> - <li><a href="rpy_demo.html">Demo</a></li> - <li><a href="rpy_faq.html">FAQ</a></li> - <li><a href="rpy_todo.html">To do</a></li> - <li><a href="http://rpy.wiki.sourceforge.net/">Wiki</a></li> + <li><a href="rpy_download.html">Download</a></li> + <!-- <li><a href="http://rpy.wiki.sourceforge.net/">Wiki</a></li> --> </ul> <b>rpy2</b> <ul class="menu"> Modified: trunk/htdocs/templates/rpy_documentation.html =================================================================== --- trunk/htdocs/templates/rpy_documentation.html 2010-10-17 18:25:48 UTC (rev 789) +++ trunk/htdocs/templates/rpy_documentation.html 2010-11-01 06:42:28 UTC (rev 790) @@ -17,11 +17,12 @@ <li> <a href="rpy/doc/rpy_html.tgz">html</a> </li> </ul> </li> + + <li><a href="rpy_faq.html">Frequently Asked Questions (FAQ)</a>.</li> - <li><a href="faq.html">Frequently Asked Questions (FAQ)</a>.</li> - <li><a href="rpy/README">Rpy README</a> file</li> + <li><a href="rpy_todo.html">TO DO list</a></li> <li>Demos <ul> <li> Modified: trunk/htdocs/templates/rpy_download.html =================================================================== --- trunk/htdocs/templates/rpy_download.html 2010-10-17 18:25:48 UTC (rev 789) +++ trunk/htdocs/templates/rpy_download.html 2010-11-01 06:42:28 UTC (rev 790) @@ -8,7 +8,12 @@ RPy Sourceforge downloads page </a>. </p> + <p> + Check the <a href="rpy_svn.html">SVN code repository</a> for a development snapshot. + </p> + + <p> For <i>rpy2</i>, check the <a href="rpy2.html">rpy2 page</a> </p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list