[R] Calling R from c in Windows XP
I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? If so, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693440.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
Have you looked at RInside ? -k On Sat, Mar 27, 2010 at 10:53 AM, dkStevens david.stev...@usu.edu wrote: I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? If so, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693440.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
If you want to call R from within VB.NET you might want to look at the statconnDCOM server (available at rcom.univie.ac.at) It wraps R into a (D)COM server and therefore allows any (D)COM client to access R on windows. VB.NET is a (D)COM client. On 3/27/2010 3:53 PM, dkStevens wrote: I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? If so, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
I've looked at this a bit and it seems ok, if not a little convoluted. We're trying to stay away from com objects, so I was hoping for something more direct. I've seen some examples (e.g. RInside) but can't get them to work -too many include files, etc. that I can't find. -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693480.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
I have - but when I tried their simple example no luck - too many missing include files to chase down. I'm looking for something more direct, I guess, that I have a little control over. -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693478.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
What examples are you talking about. You only need to include RInside.h... More information is here http://dirk.eddelbuettel.com/code/rinside.html The other external thing you need is the Rcpp package, which you can do with install.packages('Rcpp') On Sat, Mar 27, 2010 at 11:40 AM, dkStevens david.stev...@usu.edu wrote: I've looked at this a bit and it seems ok, if not a little convoluted. We're trying to stay away from com objects, so I was hoping for something more direct. I've seen some examples (e.g. RInside) but can't get them to work -too many include files, etc. that I can't find. -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693480.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
This may simply expose my ignorance in this type of coding, but, unfortunately it's not that simple because I did using the RInside.h and received several screens of error messages from gcc telling me that it couldn't find the include file and the scores of additional include files that rinside.h referred to. After much editing to point to these files those error messages went away but more screens of error messages followed. This using the four-line 'hello world' example that is provided by the RInside authors. So I'm faced with hours of chasing these down or finding a simpler example. I'd rather the latter, hence my post. -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693538.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
On 27 March 2010 at 11:50, Khanh Nguyen wrote: | What examples are you talking about. You only need to include | RInside.h... More information is here | http://dirk.eddelbuettel.com/code/rinside.html Khanh is quite correct: RInside is self-contained. It also doesn't get much simpler than the examples we show. | The other external thing you need is the Rcpp package, which you can | do with install.packages('Rcpp') It used to have a Suggests: on Rcpp but now has a Depends: on it. That said, a few things: - David probably chose to ignore the big bold signs that tell him to use gcc (in the mingw implementation). Insisting on visual whatever buys you nothing as R requires gcc and mingw. No ifs or buts. gcc/g++ it is. - We made a lot of changes between RInside 0.2.1 (which worked on Windows) and the current 0.2.2 for which the example build but then segfault. I suspect some initialization of static variables issue or something like it. I'd welcome debugging assistance from anyone with more interest in Windows than Romain and I have. - Again, a working example is provided by RInside 0.2.1, possibly coupled with a matching Rcpp release as e.g. 0.7.1 - Other simpler examples are provided in the R sources under tests/Embedding Dirk | On Sat, Mar 27, 2010 at 11:40 AM, dkStevens david.stev...@usu.edu wrote: | | I've looked at this a bit and it seems ok, if not a little convoluted. We're | trying to stay away from com objects, so I was hoping for something more | direct. I've seen some examples (e.g. RInside) but can't get them to work | -too many include files, etc. that I can't find. | -- | View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693480.html | Sent from the R help mailing list archive at Nabble.com. | | __ | R-help@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. | | | __ | R-help@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
On 27 March 2010 at 09:02, dkStevens wrote: | This may simply expose my ignorance in this type of coding, but, | unfortunately it's not that simple because I did using the RInside.h and | received several screens of error messages from gcc telling me that it | couldn't find the include file and the scores of additional include files | that rinside.h referred to. After much editing to point to these files | those error messages went away but more screens of error messages followed. | This using the four-line 'hello world' example that is provided by the | RInside authors. So I'm faced with hours of chasing these down or finding a | simpler example. I'd rather the latter, hence my post. Try to look inside the installed package RInside and to fine the directory examples/ -- it contains a directory standard/ with nine example files rinside_sample[0-8] plus two further tests (and another directory mpi/ which we ignore for now) On a correctly setup computer, building the examples programs in the directory examples/standard is as easy as saying make -f Makefile.win # you need to point make to the Windows makefile which builds all executables (on my windows box at work). No editing required. This is getting off-topic for r-help as you are asked by the posting guide to contact package authors (ie Romain or me). We usually suggest to take these RInside discussions to the rcpp-devel list --- see the R-Forge pages for Rcpp. Dirk -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
standard/ with nine example files rinside_sample[0-8] plus two further tests (and another directory mpi/ which we ignore for now) On a correctly setup computer, building the examples programs in the directory examples/standard is as easy as saying make -f Makefile.win # you need to point make to the Windows makefile which builds all executables (on my windows box at work). No editing required. This is getting off-topic for r-help as you are asked by the posting guide to contact package authors (ie Romain or me). We usually suggest to take these RInside discussions to the rcpp-devel list --- see the R-Forge pages for Rcpp. Dirk -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April! __ [hidden email] http://n4.nabble.com/user/SendEmail.jtp?type=nodenode=1693584i=0 mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. View message @ http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693584.html To unsubscribe from Re: Calling R from c in Windows XP, click here (link removed) =. -- David K Stevens, P.E., Ph.D., Professor Civil and Environmental Engineering Utah Water Research Laboratory 8200 Old Main Hill Logan, UT 84322-8200 435 797 3229 - voice 435 797 1363 - fax david.stev...@usu.edu -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693605.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
. | make: [rinside_test0] Error 2 (ignored) | Wall -s rinside_test1.cpp -o rinside_test1 | process_begin: CreateProcess(NULL, Wall -s rinside_test1.cpp -o | rinside_test1, ...) failed. | make (e=2): The system cannot find the file specified. | make: [rinside_test1] Error 2 (ignored) | | | Dirk Eddelbuettel [via R] wrote: | | On 27 March 2010 at 09:02, dkStevens wrote: | | This may simply expose my ignorance in this type of coding, but, | | unfortunately it's not that simple because I did using the RInside.h | and | | received several screens of error messages from gcc telling me that it | | couldn't find the include file and the scores of additional include | files | | that rinside.h referred to. After much editing to point to these files | | those error messages went away but more screens of error messages | followed. | | This using the four-line 'hello world' example that is provided by the | | RInside authors. So I'm faced with hours of chasing these down or | finding a | | simpler example. I'd rather the latter, hence my post. | | Try to look inside the installed package RInside and to fine the | directory | examples/ -- it contains a directory standard/ with nine example files | rinside_sample[0-8] plus two further tests (and another directory mpi/ | which | we ignore for now) | | On a correctly setup computer, building the examples programs in the | directory examples/standard is as easy as saying | | make -f Makefile.win # you need to point make to the Windows | makefile | | which builds all executables (on my windows box at work). No editing | required. | | This is getting off-topic for r-help as you are asked by the posting | guide to | contact package authors (ie Romain or me). We usually suggest to take | these | RInside discussions to the rcpp-devel list --- see the R-Forge pages | for Rcpp. | | Dirk | | -- |Registration is open for the 2nd International conference R / | Finance 2010 |See http://www.RinFinance.com for details, and see you in Chicago in | April! | | __ | [hidden email] | http://n4.nabble.com/user/SendEmail.jtp?type=nodenode=1693584i=0 | mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide | http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. | | | | View message @ | http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693584.html | | To unsubscribe from Re: Calling R from c in Windows XP, click here | (link removed) =. | | | | -- | David K Stevens, P.E., Ph.D., Professor | Civil and Environmental Engineering | Utah Water Research Laboratory | 8200 Old Main Hill | Logan, UT 84322-8200 | 435 797 3229 - voice | 435 797 1363 - fax | david.stev...@usu.edu | | | | | -- | View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693605.html | Sent from the R help mailing list archive at Nabble.com. | | [[alternative HTML version deleted]] | | __ | R-help@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from c in Windows XP
On 03/27/2010 07:53 AM, dkStevens wrote: I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? Up to this point, the answer is in Writing R Extensions, sections 8.1 and 8.2 (which has a kind of implicit dependency on 8.1). A minimal file might be embed_win.c: #include Rembedded.h int main(int argc, char *argv[]) { Rf_initEmbeddedR(argc, argv); run_Rmainloop(); Rf_endEmbeddedR(0); return 0; } and after discovering appropriate compiler args with R CMD config --cppflags R CMD config --ldflags one might (modulo line wrapping in email clients :() Z:\Home\tmpgcc -IC:/PROGRA~1/R/R-211~1.0DE/include -LC:/PROGRA~1/R/R-211~1.0DE/bin -lR embed_win.c and then Z:\Home\tmpa --vanilla x = 1:10 q() There are more examples in https://svn.r-project.org/R/trunk/tests/Embedding Martin If so, is it possible to write a simple interface using a c dll to call R functions from a Visual Basic.net program? If so, is there a simple example? Thanks to all -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.