Re: [R] Implementing R through Oracle
If it were me, I think I would try to use Rscript. R will still have to pull data using ROracle, and write back to Oracle, but the operation will be under the control of the pl/sql script. A standard R installation now includes Rscript. Rscript is intended to be used, as I recall, in a manner analogous to perl or any other typical scripting language. That is, create a file whose first line is #!/path/to/Rscript and that contains R code, including the use of ROracle. That script, if marked executable, can be executed from the command line. So if pl/sql can execute any arbitrary script file, then you can execute R from within a pl/sql script. I'm describing a unix (Linux, Mac OS) type environment. Windows is foreign territory to me. -Don At 12:41 PM -0800 11/5/07, jah wrote: >I have looked through all the ROracle documentation, R-help, R-dev, Googled >the world and still cannot figure out this issue. Everything I read it is >about connecting to an Oracle database and pulling data, processing it, and >then pushing it back to Oracle. I am running in pl/sql code so I already >have a Oracle session open. What I want to do is from Oracle call R. I am >having a mental challenge in seeing how this can be done. Any words of >wisdon? >-- >View this message in context: >http://www.nabble.com/Implementing-R-through-Oracle-tf4719929.html#a13595057 >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. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ 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] Implementing R through Oracle
Thanks for all your advice and I have spent considerable time looking at all the options. I have good new and bad news. Bad news I won't be implmenting R on our server. Good news I can keep all the business logic in the database where it belongs. What I will be doing is taking the data set and turning it into an matrix and then apply the Gauss-Jordan Elimination process to derive the coefficients of the polynomial. Oracle released in the 10g database a package (UTL_NLA.LAPACK_GTSV) that solves the matrix and returns the coefficients. At this point this is all we need to solve. Possible in the future where our needs expand I can revist implementing R. -- View this message in context: http://www.nabble.com/Implementing-R-through-Oracle-tf4719929.html#a13651047 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] Implementing R through Oracle
> I have looked through all the ROracle documentation, R-help, R-dev, > Googled the world and still cannot figure out this issue. Everything I > read it is about connecting to an Oracle database and pulling data, > processing it, and then pushing it back to Oracle. I am running in > pl/sql code so I already have a Oracle session open. What I want to do > is from Oracle call R. I am having a mental challenge in seeing how this > can be done. Any words of wisdon? EXTPROC in Oracle, calling an R CMD BATCH session? Dirty but workable. [p.s. I don't normally do Oracle but the stuff at http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_1.shtml shows basically how to do it...] --elijah __ 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] Implementing R through Oracle
jah wrote on 11/05/2007 02:41 PM: > I have looked through all the ROracle documentation, R-help, R-dev, Googled > the world and still cannot figure out this issue. Everything I read it is > about connecting to an Oracle database and pulling data, processing it, and > then pushing it back to Oracle. I am running in pl/sql code so I already > have a Oracle session open. What I want to do is from Oracle call R. I am > having a mental challenge in seeing how this can be done. Any words of > wisdon? I understand that one can write user defined functions for Oracle in java, so you might be able to bridge over to R via the rJava package. If you can write them in C, then you'll have the enviable task of embedding R into Oracle using the OCI, since no package exists. Now THAT would be a programming challenge. Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ 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] Implementing R through Oracle
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You might want to take a look at PL/R or REmbeddedPostgres (the former being a reimplementation of the latter). AFAIK, nobody has done this for Oracle, but we did do it as an experiment for MySQL and Postgres and so the ideas are there but there will be some work involved in implementing it. D. jah wrote: > I have looked through all the ROracle documentation, R-help, R-dev, Googled > the world and still cannot figure out this issue. Everything I read it is > about connecting to an Oracle database and pulling data, processing it, and > then pushing it back to Oracle. I am running in pl/sql code so I already > have a Oracle session open. What I want to do is from Oracle call R. I am > having a mental challenge in seeing how this can be done. Any words of > wisdon? -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHL4T29p/Jzwa2QP4RAsVlAJwNttd3NTGkFqVchC+lF48jfkHWvgCeOYak yqPvEdwhnZVMV0AYNUmc3a4= =8/Q7 -END PGP SIGNATURE- __ 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] Implementing R through Oracle
I have looked through all the ROracle documentation, R-help, R-dev, Googled the world and still cannot figure out this issue. Everything I read it is about connecting to an Oracle database and pulling data, processing it, and then pushing it back to Oracle. I am running in pl/sql code so I already have a Oracle session open. What I want to do is from Oracle call R. I am having a mental challenge in seeing how this can be done. Any words of wisdon? -- View this message in context: http://www.nabble.com/Implementing-R-through-Oracle-tf4719929.html#a13595057 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] Implementing R through Oracle
> I have been looking for a statistical package that I can implement in > our application and I came across R. We run an n-Tier environment with > an Oracle 10g backend. Our design is to keep all business logic in the > backend. What I would like to do is call R from pl/sql. I noticed that > ROracle is designed to connect with and process from a client > perspective. I actually would be running in the database preparing the > data and then apply the statistics to the result set for additional > information. Then I would take the results from R and apply additional > processing. Has anyone done this? Thanks. So you want to: 1) process your data, mostly inside of oracle, and are going to store it there: either in some kind of table or some kind of view 2) you want to query the data out of oracle and into R objects, probably using SELECT and storing the resultset... 3) INSERT the results of R's statistical computations back into Oracle, probably into something like a temporary table, and then do further manipulation within Oracle based on those results It sounds to me like ROracle is just what you want. I've done the above series of things before - fairly trivially, mostly by cribbing from the examples in the help() for ROracle. To be very honest getting your environment set up correctly (e.g. functioning oracle client libraries and ROracle extension) is the most difficult piece. [I did it without having touched Oracle in the last six years or so, and had to work around some bugs in the installation that 10g dropped on the disk -- it wasn't all quite ready to go, yet. Hopefully that has changed since then.] I'd love a status report on the current condition of the R->Oracle connectivity, once you get it going at your site: people occasionally ask me about it, and it isn't something that I need to do often. --elijah __ 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] Implementing R through Oracle
I have been looking for a statistical package that I can implement in our application and I came across R. We run an n-Tier environment with an Oracle 10g backend. Our design is to keep all business logic in the backend. What I would like to do is call R from pl/sql. I noticed that ROracle is designed to connect with and process from a client perspective. I actually would be running in the database preparing the data and then apply the statistics to the result set for additional information. Then I would take the results from R and apply additional processing. Has anyone done this? Thanks. -- View this message in context: http://www.nabble.com/Implementing-R-through-Oracle-tf4719929.html#a13493204 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.