A question, please about development of R packages: Are there any guidelines or best practices for deciding when and why to implement an operation in R, vs. implementing it in C? The "Writing R Extensions" recommends "working in interpreted R code . . . this is normally the best option." But we do write C-functions and access them in R - the question is, when/why is this justified, and when/why is it NOT justified? While I have identified helpful documents on R coding standards, I have not seen notes/discussions on when/why to implement in R, vs. when to implement in C. Thanks, Patrick On Sun, Jan 16, 2011 at 3:00 AM, <r-devel-request@r-project.org> wrote:> Send R-devel mailing list submissions to > r-devel@r-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://stat.ethz.ch/mailman/listinfo/r-devel > or, via email, send a message with subject or body 'help' to > r-devel-request@r-project.org > > You can reach the person managing the list at > r-devel-owner@r-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of R-devel digest..." > > > Today's Topics: > > 1. RPostgreSQL 0.1.7 for Windows 64 causes R.2.12.1 Win64 crash > (Xiaobo Gu) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 15 Jan 2011 10:34:55 +0800 > From: Xiaobo Gu <guxiaobo1982@gmail.com> > To: r-devel@r-project.org > Subject: [Rd] RPostgreSQL 0.1.7 for Windows 64 causes R.2.12.1 Win64 > crash > Message-ID: > <AANLkTinvoub-z_Le1GVPYswnqTsW1P6MZzLZsztois9K@mail.gmail.com> > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > I build the binary package file of RPostgreSQL 0.1.7 for Windows 2003 > Server R2 64 bit SP2, the software environments are as following: > R 2.12.1 for Win64 > RTools212 for Win64 > DBI 0.2.5 > RPostgreSQL 0.1.7 > Postgresql related binaries shipped with > postgresql-9.0.2-1-windows_x64.exe from EnterpriseDB > > The package can be loaded, and driver can be created, but the > dbConnect function causes the whole RGui crashes, > > driver <- dbDriver("PostgreSQL") > con <- dbConnect(driver, dbname="demo", host="192.168.8.1", > user="postgres", password="postgres", port=5432) > > > > ------------------------------ > > _______________________________________________ > R-devel@r-project.org mailing list DIGESTED > https://stat.ethz.ch/mailman/listinfo/r-devel > > > End of R-devel Digest, Vol 95, Issue 14 > *************************************** >[[alternative HTML version deleted]]
Everyone has their own utility function. Mine is if the boredom of waiting for the pure R function to finish is going to out-weight the boredom of writing the C code. Another issue is that adding C code increases the hassle of users who might want the code to run on different architectures. On 17/01/2011 17:13, Patrick Leyshock wrote:> A question, please about development of R packages: > > Are there any guidelines or best practices for deciding when and why to > implement an operation in R, vs. implementing it in C? The "Writing R > Extensions" recommends "working in interpreted R code . . . this is normally > the best option." But we do write C-functions and access them in R - the > question is, when/why is this justified, and when/why is it NOT justified? > > While I have identified helpful documents on R coding standards, I have not > seen notes/discussions on when/why to implement in R, vs. when to implement > in C. > > Thanks, Patrick > > On Sun, Jan 16, 2011 at 3:00 AM,<r-devel-request at r-project.org> wrote: > >> Send R-devel mailing list submissions to >> r-devel at r-project.org >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://stat.ethz.ch/mailman/listinfo/r-devel >> or, via email, send a message with subject or body 'help' to >> r-devel-request at r-project.org >> >> You can reach the person managing the list at >> r-devel-owner at r-project.org >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of R-devel digest..." >> >> >> Today's Topics: >> >> 1. RPostgreSQL 0.1.7 for Windows 64 causes R.2.12.1 Win64 crash >> (Xiaobo Gu) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Sat, 15 Jan 2011 10:34:55 +0800 >> From: Xiaobo Gu<guxiaobo1982 at gmail.com> >> To: r-devel at r-project.org >> Subject: [Rd] RPostgreSQL 0.1.7 for Windows 64 causes R.2.12.1 Win64 >> crash >> Message-ID: >> <AANLkTinvoub-z_Le1GVPYswnqTsW1P6MZzLZsztois9K at mail.gmail.com> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Hi, >> I build the binary package file of RPostgreSQL 0.1.7 for Windows 2003 >> Server R2 64 bit SP2, the software environments are as following: >> R 2.12.1 for Win64 >> RTools212 for Win64 >> DBI 0.2.5 >> RPostgreSQL 0.1.7 >> Postgresql related binaries shipped with >> postgresql-9.0.2-1-windows_x64.exe from EnterpriseDB >> >> The package can be loaded, and driver can be created, but the >> dbConnect function causes the whole RGui crashes, >> >> driver<- dbDriver("PostgreSQL") >> con<- dbConnect(driver, dbname="demo", host="192.168.8.1", >> user="postgres", password="postgres", port=5432) >> >> >> >> ------------------------------ >> >> _______________________________________________ >> R-devel at r-project.org mailing list DIGESTED >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >> >> End of R-devel Digest, Vol 95, Issue 14 >> *************************************** >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Patrick Burns pburns at pburns.seanet.com twitter: @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of 'Some hints for the R beginner' and 'The R Inferno')
On 17 January 2011 at 09:13, Patrick Leyshock wrote: | A question, please about development of R packages: | | Are there any guidelines or best practices for deciding when and why to | implement an operation in R, vs. implementing it in C? The "Writing R | Extensions" recommends "working in interpreted R code . . . this is normally | the best option." But we do write C-functions and access them in R - the | question is, when/why is this justified, and when/why is it NOT justified? | | While I have identified helpful documents on R coding standards, I have not | seen notes/discussions on when/why to implement in R, vs. when to implement | in C. The (still fairly recent) book 'Software for Data Analysis: Programming with R' by John Chambers (Springer, 2008) has a lot to say about this. John also gave a talk in November which stressed 'multilanguage' approaches; see e.g. http://blog.revolutionanalytics.com/2010/11/john-chambers-on-r-and-multilingualism.html In short, it all depends, and it is unlikely that you will get a coherent answer that is valid for all circumstances. We all love R for how expressive and powerful it is, yet there are times when something else is called for. Exactly when that time is depends on a great many things and you have not mentioned a single metric in your question. So I'd start with John's book. Hope this helps, Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
<p>Tests and examples are different things. The fact that your example runs only means that your code does not bomb on execution and not that it runs correctly. Plus, the code in examples is meant as an aid to the user; a way to help them understand how to use your code. Proper tests are there to make sure your code executes properly and computes things correctly. <br></p> [[alternative HTML version deleted]]
Apparently Analagous Threads
- Package RPostgreSQL_0.1-6.tar.gz has been checked and built
- How to create ff objects from database connection
- No response after click the "show Rules" button on Tab "Associate".
- how to connect to a remote PostgreSQL database from R on mac osx
- R encoding question