Skip to content

[Rcpp-devel] [ANN] RInside 0.2.9

15 messages · Dirk Eddelbuettel, David Ibarra Gómez, Darren Cook

#
RInside 0.2.9 went to CRAN early today; I just wrote up a short blog post you
can find at 

   http://dirk.eddelbuettel.com/blog/2012/11/05#rinside_0.2.9

A non-hypertext copy of the post is below.

Cheers, Dirk


    Thinking inside the box                            

    Mon, 05 Nov 2012                                       
                                                       
    RInside 0.2.9                                      
    A new version 0.2.9 of RInside arrived on CRAN     
    earlier today; Windows binaries have already been  
    built too. RInside provides a set of convenience   
    classes which facilitate embedding of R inside of  
    C++ applications and programs, using the classes   
    and functions provided by the Rcpp R and C++       
    integration package.                               
                                                       
    This release adds a few new features as detailed   
    in the extract from the NEWS below.                
                                                       
    A key new feature is the added support for         
    resilience to bad user input based on discussions  
    and an initial (but altered) patch by Theodore     
    Lytras. There are a few ways that this can be      
    deployedon so we also added two more example       
    programs detailing it. The featured Qt example and 
    the Wt example have been updated to use this too.  
                                                       
    Another feature that may be quite useful for some  
    is the additonal attempt to find a value for       
    R_HOME if none has been set. The value is          
    typically found at compile time of the RInside     
    package which poses a problem for those using the  
    Windows build -- which is shipped as a binary      
    reflecting the value of the build system. One      
    alternative has always been to build the package   
    locally too to get the local value, or to set it   
    explicitly. But because the error behaviour - a    
    cryptic message of Cannot open base package - is   
    confusing to many, we now try to call the R        
    function which gets this value from the registry.  
    This may need more tweaking and testing, and if    
    you use RInside on the Windows platform I would    
    appreciate feedback.                               
                                                       
    The complete list of changes since the last        
    release are summarized below in the corresponding  
    NEWS file entry:                                   
                                                       
        Changes in RInside version 0.2.9 (2012-11-04)  
                                                       
        * Applied (modified) patch by Theodore Lytras  
          which lets RInside recover from some parsing 
          errors and makes RInside applications more   
          tolerant of errors                           
                                                       
        * Added non-throwing variants of parseEval()   
          and parseEvalQ()                             
                                                       
        * Modified Qt and Wt examples of density       
          estimation applications to be much more      
          resilient to bad user input                  
                                                       
        * On Windows, have RInside use R's             
          get_R_HOME() function to get R_HOME value    
          from registry if not set by user             
                                                       
        * Added note to examples/standard/Makefile.win 
          that R_HOME may need to be set to run the    
          executables - so either export your local    
          value, or re-install RInside from source to  
          have it reflected in the library build of    
          libRinside                                   
                                                       
        * Updated CMake build support for standard,    
          armadillo and eigen                          
                                                       
        * Improved CMake builds of examples/standard,  
          examples/eigen and examples/armadillo by     
          detecting architecture                       
                                                       
    CRANberries also provides a short report with      
    changes from the previous release. More            
    information is on the RInside page. Questions,     
    comments etc should go to the rcpp-devel mailing   
    list off the Rcpp R-Forge page.                    
                                                       
                        /code/rinside | permanent link
#
Hello Dirk,

        it's nice to see how RInside gets even better. I saw the example of the "R.parseEvalQNT(cmd)". I have a question. Is it supposed to work if the cmd command it's correct but throws an exception (for example the routine crashes because has some NA data)?.

Regards




David Ibarra Gomez
Jefe de Proyectos
Aqualogy Aqua Ambiente






-----Mensaje original-----
De: rcpp-devel-bounces at lists.r-forge.r-project.org [mailto:rcpp-devel-bounces at lists.r-forge.r-project.org] En nombre de Dirk Eddelbuettel
Enviado el: martes, 06 de noviembre de 2012 1:42
Para: rcpp-devel at r-forge.wu-wien.ac.at
Asunto: [Rcpp-devel] [ANN] RInside 0.2.9


RInside 0.2.9 went to CRAN early today; I just wrote up a short blog post you can find at

   http://dirk.eddelbuettel.com/blog/2012/11/05#rinside_0.2.9

A non-hypertext copy of the post is below.

Cheers, Dirk


    Thinking inside the box

    Mon, 05 Nov 2012

    RInside 0.2.9
    A new version 0.2.9 of RInside arrived on CRAN
    earlier today; Windows binaries have already been
    built too. RInside provides a set of convenience
    classes which facilitate embedding of R inside of
    C++ applications and programs, using the classes
    and functions provided by the Rcpp R and C++
    integration package.

    This release adds a few new features as detailed
    in the extract from the NEWS below.

    A key new feature is the added support for
    resilience to bad user input based on discussions
    and an initial (but altered) patch by Theodore
    Lytras. There are a few ways that this can be
    deployedon so we also added two more example
    programs detailing it. The featured Qt example and
    the Wt example have been updated to use this too.

    Another feature that may be quite useful for some
    is the additonal attempt to find a value for
    R_HOME if none has been set. The value is
    typically found at compile time of the RInside
    package which poses a problem for those using the
    Windows build -- which is shipped as a binary
    reflecting the value of the build system. One
    alternative has always been to build the package
    locally too to get the local value, or to set it
    explicitly. But because the error behaviour - a
    cryptic message of Cannot open base package - is
    confusing to many, we now try to call the R
    function which gets this value from the registry.
    This may need more tweaking and testing, and if
    you use RInside on the Windows platform I would
    appreciate feedback.

    The complete list of changes since the last
    release are summarized below in the corresponding
    NEWS file entry:

        Changes in RInside version 0.2.9 (2012-11-04)

        * Applied (modified) patch by Theodore Lytras
          which lets RInside recover from some parsing
          errors and makes RInside applications more
          tolerant of errors

        * Added non-throwing variants of parseEval()
          and parseEvalQ()

        * Modified Qt and Wt examples of density
          estimation applications to be much more
          resilient to bad user input

        * On Windows, have RInside use R's
          get_R_HOME() function to get R_HOME value
          from registry if not set by user

        * Added note to examples/standard/Makefile.win
          that R_HOME may need to be set to run the
          executables - so either export your local
          value, or re-install RInside from source to
          have it reflected in the library build of
          libRinside

        * Updated CMake build support for standard,
          armadillo and eigen

        * Improved CMake builds of examples/standard,
          examples/eigen and examples/armadillo by
          detecting architecture

    CRANberries also provides a short report with
    changes from the previous release. More
    information is on the RInside page. Questions,
    comments etc should go to the rcpp-devel mailing
    list off the Rcpp R-Forge page.

                        /code/rinside | permanent link


--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com _______________________________________________
Rcpp-devel mailing list
Rcpp-devel at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Disclaimer: http://disclaimer.aqualogy.net/
#
On 6 November 2012 at 08:30, David Ibarra G?mez wrote:
|         it's nice to see how RInside gets even better. I saw the example of the "R.parseEvalQNT(cmd)". I have a question. Is it supposed to work if the cmd command it's correct but throws an exception (for example the routine crashes because has some NA data)?.

If you have code that can throw you cannot use the no-throw variant as you
would end up with undefined behaviour.

Dirk
#
Hello Dirk,
Where would you choose to use parseEvalQNT() instead of parseEvalQ()?

(I.e. even if you were 100% sure your code would never throw, does
parseEvalQ() have a downside?)

Thanks,

Darren Cook
Director, QQ Trend
http://qqtrend.com
#
On 7 November 2012 at 10:16, Darren Cook wrote:
| > nice to see how RInside gets even better. I saw the example of the
| > "R.parseEvalQNT(cmd)". I have a question. Is it supposed to work if
| > the cmd command it's correct but throws an exception (for example the
| > routine crashes because has some NA data)?.
| > 
| > If you have code that can throw you cannot use the no-throw variant
| > as you would end up with undefined behaviour.
| 
| Hello Dirk,
| Where would you choose to use parseEvalQNT() instead of parseEvalQ()?

Please see examples/standard/rinside_sample14.cpp for one example. If you use
the throwing variant, you "jump".
 
| (I.e. even if you were 100% sure your code would never throw, does
| parseEvalQ() have a downside?)

Well "it depends" as it always does. 

So I provide an API with different options.  You get to pick.

Hth, Dirk
#
On 6 November 2012 at 05:21, Dirk Eddelbuettel wrote:
|
| On 6 November 2012 at 08:30, David Ibarra G?mez wrote:
| |         it's nice to see how RInside gets even better. I saw the example of the "R.parseEvalQNT(cmd)". I have a question. Is it supposed to work if the cmd command it's correct but throws an exception (for example the routine crashes because has some NA data)?.
| 
| If you have code that can throw you cannot use the no-throw variant as you
| would end up with undefined behaviour.

Sorry, I worded that pretty much exactly upside down, so let me try again:

  If you have code that does not _catch_ possible exceptions _thrown by
  RInside on error_ you have to use the no-throw variant.

Dirk
#
mmmm, I think that sooner or later I will try the code that abruptly ends the proccess that called RInside with the new "NT" routine and see what happends... I was allready using try-catch but the program ended abruptly anyway...

Thank you


David Ibarra Gomez
Jefe de Proyectos




-----Mensaje original-----
De: Dirk Eddelbuettel [mailto:edd at debian.org]
Enviado el: mi?rcoles, 07 de noviembre de 2012 14:34
Para: Dirk Eddelbuettel
CC: David Ibarra G?mez; rcpp-devel at r-forge.wu-wien.ac.at
Asunto: RE: [Rcpp-devel] [ANN] RInside 0.2.9
On 6 November 2012 at 05:21, Dirk Eddelbuettel wrote:
|
| On 6 November 2012 at 08:30, David Ibarra G?mez wrote:
| |         it's nice to see how RInside gets even better. I saw the example of the "R.parseEvalQNT(cmd)". I have a question. Is it supposed to work if the cmd command it's correct but throws an exception (for example the routine crashes because has some NA data)?.
|
| If you have code that can throw you cannot use the no-throw variant as
| you would end up with undefined behaviour.

Sorry, I worded that pretty much exactly upside down, so let me try again:

  If you have code that does not _catch_ possible exceptions _thrown by
  RInside on error_ you have to use the no-throw variant.

Dirk

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

Disclaimer: http://disclaimer.aqualogy.net/
#
On 7 November 2012 at 15:46, David Ibarra G?mez wrote:
| mmmm, I think that sooner or later I will try the code that abruptly ends the proccess that called RInside with the new "NT" routine and see what happends... I was allready using try-catch but the program ended abruptly anyway...

Please look at the two new examples and the new test and experiment with
these to find a pattern that suits you.   If you have concrete suggestions
(ie "patches") for improvements (for code and/or documentation) let us know.

Dirk
#
Yes, I already did that, but I didn't try because your first answer (and because I need to upgrade ...).

I'll tell you about improvements.

Thank you again Dirk.



David Ibarra Gomez
Jefe de Proyectos


-----Mensaje original-----
De: Dirk Eddelbuettel [mailto:edd at debian.org]
Enviado el: mi?rcoles, 07 de noviembre de 2012 15:52
Para: David Ibarra G?mez
CC: Dirk Eddelbuettel; rcpp-devel at r-forge.wu-wien.ac.at
Asunto: RE: [Rcpp-devel] [ANN] RInside 0.2.9
On 7 November 2012 at 15:46, David Ibarra G?mez wrote:
| mmmm, I think that sooner or later I will try the code that abruptly ends the proccess that called RInside with the new "NT" routine and see what happends... I was allready using try-catch but the program ended abruptly anyway...

Please look at the two new examples and the new test and experiment with
these to find a pattern that suits you.   If you have concrete suggestions
(ie "patches") for improvements (for code and/or documentation) let us know.

Dirk

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

Disclaimer: http://disclaimer.aqualogy.net/
#
Just for information.

When I call make (for RInside using RInside_0.2.9.tar.gz) I get a crash here:
...
g++ -I/usr/local/lib/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -g -O2 -Wall -I/usr/local/include   rinside_sample11.cpp  -L/usr/local/lib/R/lib -lR  -L/usr/local/lib/R/lib -lRblas -L/usr/local/lib/R/lib -lRlapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample11
rinside_sample11.cpp: In function ?int main(int, char**)?:
rinside_sample11.cpp:24:25: error: ?unlink? was not declared in this scope
make: *** [rinside_sample11] Error 1
...

Regards



David Ibarra Gomez
Jefe de Proyectos

Disclaimer: http://disclaimer.aqualogy.net/
#
On 8 November 2012 at 12:37, David Ibarra G?mez wrote:
| Just for information.
| 
| When I call make (for RInside using RInside_0.2.9.tar.gz) I get a crash here:
| ...
| g++ -I/usr/local/lib/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -g -O2 -Wall -I/usr/local/include   rinside_sample11.cpp  -L/usr/local/lib/R/lib -lR  -L/usr/local/lib/R/lib -lRblas -L/usr/local/lib/R/lib -lRlapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample11
| rinside_sample11.cpp: In function ?int main(int, char**)?:
| rinside_sample11.cpp:24:25: error: ?unlink? was not declared in this scope
| make: *** [rinside_sample11] Error 1
| ...

That is not a "crash", that is a failure to build.  Is unlink() not available
on Windows?

Use 'make -k -f Makefile.win' to proceed after the error.

Dirk
#
Sorry for the word "crash".

That happend with Linux Debian (not windows). I just invoked make at "standard" folder of RInside examples in order to build some examples (just testing a new installation).




David Ibarra Gomez
Jefe de Proyectos





-----Mensaje original-----
De: Dirk Eddelbuettel [mailto:edd at debian.org]
Enviado el: jueves, 08 de noviembre de 2012 14:07
Para: David Ibarra G?mez
CC: rcpp-devel at r-forge.wu-wien.ac.at
Asunto: Re: [Rcpp-devel] [ANN] RInside 0.2.9
On 8 November 2012 at 12:37, David Ibarra G?mez wrote:
| Just for information.
|
| When I call make (for RInside using RInside_0.2.9.tar.gz) I get a crash here:
| ...
| g++ -I/usr/local/lib/R/include -I/usr/local/lib/R/site-library/Rcpp/include -I/usr/local/lib/R/site-library/RInside/include -g -O2 -Wall -I/usr/local/include   rinside_sample11.cpp  -L/usr/local/lib/R/lib -lR  -L/usr/local/lib/R/lib -lRblas -L/usr/local/lib/R/lib -lRlapack -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -L/usr/local/lib/R/site-library/RInside/lib -lRInside -Wl,-rpath,/usr/local/lib/R/site-library/RInside/lib -o rinside_sample11
| rinside_sample11.cpp: In function ?int main(int, char**)?:
| rinside_sample11.cpp:24:25: error: ?unlink? was not declared in this
| scope
| make: *** [rinside_sample11] Error 1
| ...

That is not a "crash", that is a failure to build.  Is unlink() not available on Windows?

Use 'make -k -f Makefile.win' to proceed after the error.

Dirk

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

Disclaimer: http://disclaimer.aqualogy.net/
#
On 8 November 2012 at 15:39, David Ibarra G?mez wrote:
| Sorry for the word "crash".
| 
| That happend with Linux Debian (not windows). I just invoked make at "standard" folder of RInside examples in order to build some examples (just testing a new installation).

And I read the error message wrong -- 'foo' not declared means we lack a
declaration, so maybe we didn't include a header.  'man 2 unlink' points to
unistd.h, try including that (though I think we may have it already sourced).
So please also try std::unlink or ::unlink, please report back.

And next time you report a build error, please state

   operating system 

   compiler and version

and other pertinent information to not waste everybody's time trying to
guess from a distance.

Dirk
#
Hi Dirk,

        including unistd.h works. Nevertheless neither std:: or ::unlik worked.

The next time I'll be reporting with all pertinent data, sorry for the wasted time.

Peace!


David Ibarra Gomez

Asunto: RE: [Rcpp-devel] [ANN] RInside 0.2.9
On 8 November 2012 at 15:39, David Ibarra G?mez wrote:
| Sorry for the word "crash".
|
| That happend with Linux Debian (not windows). I just invoked make at "standard" folder of RInside examples in order to build some examples (just testing a new installation).

And I read the error message wrong -- 'foo' not declared means we lack a declaration, so maybe we didn't include a header.  'man 2 unlink' points to unistd.h, try including that (though I think we may have it already sourced).
So please also try std::unlink or ::unlink, please report back.

And next time you report a build error, please state

   operating system

   compiler and version

and other pertinent information to not waste everybody's time trying to guess from a distance.

Dirk

--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

Disclaimer: http://disclaimer.aqualogy.net/
#
On 8 November 2012 at 17:35, David Ibarra G?mez wrote:
|         including unistd.h works. Nevertheless neither std:: or ::unlik worked.

Thanks for reporting back --  examples/standard/rinside_sample11.cpp has been
updated accordingly.

Dirk