Re: [Rd] Package development process?
Thanks. I added rows for C++, Haskell, and PHP from your stackoverflow.com reference. I skipped the rest because I wasn't sure if they really fit and because I ran out of time for this right now. More suggestions (including encouragement to study the stackoverflow.com reference more) will be welcomed. Thanks again, Spencer On 6/15/2010 11:24 PM, Rainer Stuetz wrote: On Wed, Jun 16, 2010 at 6:20 AM, Spencer Graves wrote: Thanks. I added a row for Ruby and columns for "Package manager" and "Collaborative development platform" to the table of "Selected Repositories" in the Wikipedia entry for "Software repository". Please correct me if I'm wrong, but the Wiki page for Ruby suggested to me that RubyGems is a package manager, crudely comparable to the "R CMD check process", while the Ruby counterpart for CRAN is the "Ruby Application Archive (RAA)". In addition, there is "RubyForge", which sounds like analogous to R-Forge. If this is incorrect or can otherwise be improved, please either let me know or change the Wiki yourself. Any other suggestions? Thanks again, Spencer See this thread on stackoverflow.com: List of Top Repositories by Programming Language http://stackoverflow.com/questions/1693529/ Rainer -- Spencer Graves, PE, PhD President and Chief Operating Officer Structure Inspection and Monitoring, Inc. 751 Emerson Ct. San José, CA 95126 ph: 408-655-4567 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] using C++ finalizers for external pointers
Hello, In Rcpp, we use a C++ template to finalizers for external pointers: template void delete_finalizer(SEXP p){ if( TYPEOF(p) == EXTPTRSXP ){ T* ptr = (T*) EXTPTR_PTR(p) ; delete ptr ; } } This works fine. Or at least it has appeared to work fine for some time. However, when compiled with suncc, this generates warnings [1] because the generated function is of C++ linkage and the finalizer type is declared to have C linkage in Rinternals.h extern "C" { ... typedef void (*R_CFinalizer_t)(SEXP); void R_RegisterFinalizer(SEXP s, SEXP fun); void R_RegisterCFinalizer(SEXP s, R_CFinalizer_t fun); void R_RegisterFinalizerEx(SEXP s, SEXP fun, Rboolean onexit); void R_RegisterCFinalizerEx(SEXP s, R_CFinalizer_t fun, Rboolean onexit); ... } Does anyone know a workaround ? Would using an R finalizer (with R_RegisterFinalizer) using another external pointer to some class be appropriate ? Romain [1] : http://article.gmane.org/gmane.comp.lang.r.rcpp/433 -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/98Uf7u : Rcpp 0.8.1 |- http://bit.ly/c6YnCi : graph gallery collage `- http://bit.ly/bZ7ltC : inline 0.3.5 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Package development process?
On Wed, Jun 16, 2010 at 12:20 AM, Spencer Graves wrote: > Hi, Gabor: > > > Thanks. I added a row for Ruby and columns for "Package manager" and > "Collaborative development platform" to the table of "Selected Repositories" > in the Wikipedia entry for "Software repository". Please correct me if I'm > wrong, but the Wiki page for Ruby suggested to me that RubyGems is a package > manager, crudely comparable to the "R CMD check process", while the Ruby > counterpart for CRAN is the "Ruby Application Archive (RAA)". In addition, > there is "RubyForge", which sounds like analogous to R-Forge. If this is > incorrect or can otherwise be improved, please either let me know or change > the Wiki yourself. > > > Any other suggestions? > Thanks again, > Spencer There is also a package repository at http://rubygems.org __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] R CMD check error in v2.12.0
I have received the following error for my package oro.nifti under "CRAN checks" for r-devel-linux-ix86; i.e., http://www.r-project.org/nosvn/R.check/r-devel-linux-ix86/oro.nifti-00check.html - using R version 2.12.0 Under development (unstable) (2010-06-12 r52259) - using platform: i686-pc-linux-gnu (32-bit) - using session charset: UTF-8 - checking for file oro.nifti/DESCRIPTION ... OK - this is package oro.nifti version 0.1.4 - checking package name space information ... OK - checking package dependencies ... OK - checking if this is a source package ... OK - checking for executable files ... OK - checking whether package oro.nifti can be installed ... OK - checking package directory ... OK - checking for portable file names ... OK - checking for sufficient/correct file permissions ... OK - checking DESCRIPTION meta-information ... OK - checking top-level files ... OK - checking index information ... OK - checking package subdirectories ... OK - checking R files for non-ASCII characters ... OK - checking R files for syntax errors ... OK - checking whether the package can be loaded ... OK - checking whether the package can be loaded with stated dependencies ... OK - checking whether the package can be unloaded cleanly ... OK - checking whether the name space can be loaded with stated dependencies ... OK - checking whether the name space can be unloaded cleanly ... OK - checking for unstated dependencies in R code ... OK - checking S3 generic/method consistency ... OK - checking replacement functions ... OK - checking foreign function calls ... OK - checking R code for possible problems ... OK - checking Rd files ... OK - checking Rd metadata ... OK - checking Rd cross-references ... OK - checking for missing documentation entries ... OK - checking for code/documentation mismatches ... OK - checking Rd \usage sections ... OK - checking Rd contents ... OK - checking examples ... ERROR Running examples in oro.nifti-Ex.R failed The error most likely occurred in: > ### Name: writeNIfTI > ### Title: writeNIfTI > ### Aliases: writeNIfTI > ### Keywords: file > > ### ** Examples > > norm <- dnorm(seq(-5, 5, length=32), sd=2) > norm <- (norm-min(norm)) / max(norm-min(norm)) > img <- outer(outer(norm, norm), norm) > img <- round(255 * img) > img[17:32,,] <- 255 - img[17:32,,] > img.nifti <- nifti(img) # create NIfTI object > > writeNIfTI(img.nifti, "test-nifti-image-uint8", verbose=TRUE) niftiExtension detected! niftiAuditTrail detected! vox_offset = 1392 *writing niftiExtension(s) at byte = 6.803919e+17 # <- LARGE NUMBER! writing data at byte = 6.803919e+17 # <- LARGE NUMBER!* > ## These files should be viewable in, for example, FSLview > ## Make sure you adjust the min/max values for proper visualization > data <- readNIfTI("test-nifti-image-uint8", verbose=TRUE) fname = test-nifti-image-uint8 files = test-nifti-image-uint8.nii.gz nii = test-nifti-image-uint8.nii.gz vox_offset = 1392 niftiExtension detected! Error in read.nifti.content(fname, gzipped = TRUE, verbose = verbose, : -- extension size (esize) has overshot voxel offset -- Calls: readNIfTI -> read.nifti.content Execution halted Please draw your attention to the two lines annotated above. The line of code that "looks a bit odd" above is cat(" writing niftiExtension(s) at byte =", seek(fid), fill=TRUE) ...where fid is a call to file()... and this large number is causing the subsequent read function to fail. My questions are: - Why would this error occur in 32-bit linux only for R 2.12.0? - How can I test any fixes to this error given I am not running R in 32-bit linux? Any suggestions would be welcome. Thank-you, Brandon [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Package development process?
Hi Spencer, I think it is the emphasis on documentation that makes the R development process unique. Many other languages have equivalents to CRAN and R-forge - few others require the attention to documentation that R does. Hadley On Tue, Jun 15, 2010 at 8:45 PM, Spencer Graves wrote: > Hello, All: > > > What thoughts might you have on "The R Software Package Development > Process"? > > > I'm looking for ideas, materials, references, and / or collaborators > for an article on this topic to be submitted to the Communications of the > ACM. My limited experience with other languages such as Matlab and Python > suggests that R may be fairly unique with CRAN and this accompanying package > development process -- and users of other languages might benefit from > emulating R in this regard. We have an immediate deadline of Sept. 15, when > Sundar and I are scheduled to speak on this topic for the San Francisco Bay > Chapter of the Association for Computing Machinery. > > > So far my literature search for comparable capabilities for other > languages have produced essentially nothing comparable.(a) Sundar and I > added a section on "Selected Repositories" to the Wikipedia "Software > repository" entry (http://en.wikipedia.org/wiki/Software_repository). > > > Thanks, > Spencer Graves > > ## > (a) I have material discussed by Merijn de Jonge, Eindhoven University of > Technology on "Package-Based Software Development" at the 29th Euromicro > Conference (EUROMICRO'03), > Belek-Antalya, Turkey, September 01-September 06 > (http://www.computer.org/portal/web/csdl/doi/10.1109/EURMIC.2003.1231570). > I'm also familiar with material by Friedrich Leisch, Sundar and I on > "Creating R Packages" available as contributed documentation from CRAN. > > -- > Spencer Graves, PE, PhD > President and Chief Operating Officer > Structure Inspection and Monitoring, Inc. > 751 Emerson Ct. > San José, CA 95126 > ph: 408-655-4567 > > __ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Package development process?
Hi, Hadley: What about the encouragement to add unit tests, if only disguised as examples? I've found the unit tests to be a powerful tool to help improve and maintain the quality of packages to which I contribute. To this end, Sundar and I added a column "Autochecks" to the table of "Selected Repositories" in the Wikipedia article on "Software repository" (http://en.wikipedia.org/wiki/Software_repository), and we describe it briefly in the text introducing that table. I may expand that discussion based on the reply from you and others, then try to contact leaders for the different languages / repositories, asking them to improve this discussion -- or send me comments to incorporate. Best Wishes, Spencer On 6/16/2010 7:19 AM, Hadley Wickham wrote: Hi Spencer, I think it is the emphasis on documentation that makes the R development process unique. Many other languages have equivalents to CRAN and R-forge - few others require the attention to documentation that R does. Hadley On Tue, Jun 15, 2010 at 8:45 PM, Spencer Graves wrote: Hello, All: What thoughts might you have on "The R Software Package Development Process"? I'm looking for ideas, materials, references, and / or collaborators for an article on this topic to be submitted to the Communications of the ACM. My limited experience with other languages such as Matlab and Python suggests that R may be fairly unique with CRAN and this accompanying package development process -- and users of other languages might benefit from emulating R in this regard. We have an immediate deadline of Sept. 15, when Sundar and I are scheduled to speak on this topic for the San Francisco Bay Chapter of the Association for Computing Machinery. So far my literature search for comparable capabilities for other languages have produced essentially nothing comparable.(a) Sundar and I added a section on "Selected Repositories" to the Wikipedia "Software repository" entry (http://en.wikipedia.org/wiki/Software_repository). Thanks, Spencer Graves ## (a) I have material discussed by Merijn de Jonge, Eindhoven University of Technology on "Package-Based Software Development" at the 29th Euromicro Conference (EUROMICRO'03), Belek-Antalya, Turkey, September 01-September 06 (http://www.computer.org/portal/web/csdl/doi/10.1109/EURMIC.2003.1231570). I'm also familiar with material by Friedrich Leisch, Sundar and I on "Creating R Packages" available as contributed documentation from CRAN. -- Spencer Graves, PE, PhD President and Chief Operating Officer Structure Inspection and Monitoring, Inc. 751 Emerson Ct. San José, CA 95126 ph: 408-655-4567 __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] Package development process?
> What about the encouragement to add unit tests, if only disguised as > examples? Examples are not unit tests. Examples are a convenient way of testing some aspects of the package, but serve a rather different purpose to tests. The R community does not emphase testing nearly as much as other communities. For example, Ruby has a very strong testing culture including at least 10 different unit testing frameworks. > I've found the unit tests to be a powerful tool to help improve and > maintain the quality of packages to which I contribute. To this end, Sundar > and I added a column "Autochecks" to the table of "Selected Repositories" in > the Wikipedia article on "Software repository" > (http://en.wikipedia.org/wiki/Software_repository), and we describe it > briefly in the text introducing that table. Unfortunately your description highlights a inadequacy of R and poor software development procedures on the part of many R package developers (including me!). For exactly the reason you discuss, it's never a good idea for your package to depend on the most current version of another package. If you do, changes to that package might break yours. Most other package management systems allow you to specify the version of a dependency so that this doesn't happen. You can do this with R, but because it's hard to have multiple versions of the same package installed at the same time, it's not as useful. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] GUI's and R background processes
> I am new to R and have created an application using R 2.10, with a graphical > UI using TclTk 8.5, running on windows 7, quad core machine. > The intention of the application is to launch calculations and display > results on a graphical dashboard. > > I've reached a roadblock, and I need to confirm that the following CANNOT be > done. I've been trying to find a mechanism for doing the following: > > 1. From the dashboard, start a huge calculation (i.e. call a function) that > take at least 30 seconds to run, but without tying up the other dashboard > features > 2. Dashboard can detect when the calculation is finished > 3. Dashboard can display incremental results as the calculation runs (i.e. > status/progress) > > The requirement is to kickoff 4 calculations (#1), but I don't want the user > to wait for the others to finish. > The calculations are not dependent. I just need to display results. > > I've been reading that threading in R is not an option. I tried using the > multicore package, but that is still synchronous. I looked at multicore, > fork(), addTaskCallback(), and TclTk threading, and none of these seem like > an option. > > Is there a way to launch multiple R scripts from controller that can > communicate back and forth? I believe this means that the separate processes > are able to communicate. > > I certainly appreciate any direction you can provide. I really want to find > some good news to tell the boss, though, since we went down this path before > realizing the limitations. Another option to consider is moving to a client/server architecture. Even if the dashboard and the R engine are on the same machine now, in the future you might want to deploy the dashboard to the web (or other client) to make it available to a wider audience. This also might make the asynchronous communication easier to manage, and offload computations from the client machine. There are several options out there, including: - Rserve, open source project maintained by Simon Urbanek. http://rosuda.org/Rserve/ - Biocep-R. http://biocep-distrib.r-forge.r-project.org/. Also open source. - Spotfire Statistics Services: commercial solution from TIBCO (my company), that providers server access to a cluster of R and S+ engines via Java and C# APIs. http://spotfire.tibco.com/products/statistics-services/predictive-analytics.aspx Good luck, Lou -- Lou Bajuk-Yorgan Sr. Director, Product Management Spotfire, TIBCO Software 206-802-2328 lba...@tibco.com http://spotfire.tibco.com TIBCO Spotfire Analytics Better than BI. Smarter than Spreadsheets. (click here for the Top 5 reasons why...) __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] cut takes long time
The following cut command takes nearly 10 seconds on my machine even though the length of input vector is only 6. I am running on Windows Vista with C2D BLAS using R 2.11.1. Using the default BLAS and either R 2.10.1 or "R version 2.12.0 Under development (unstable) (2010-05-31 r52164)" also gives me results in the 9-11 second range. I would have expected it to take much less time. tt <- structure(c(631206000, 631206060, 631206180, 631206240, 631206300, 978224400), class = c("POSIXt", "POSIXct"), tzone = "") system.time(cut(tt, "2 hours", include = TRUE)) # 9.45 0.01 9.58 R.version.string # "R version 2.11.1 Patched (2010-05-31 r52167)" win.version() # "Windows Vista (build 6002) Service Pack 2" __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
[Rd] constrOptim( ): conflict between help page and code
There is a contradiction between what the help page says and what constrOptim actually does with the constraints. The issue is what happens on the boundary. The help page says The feasible region is defined by ‘ui %*% theta - ci >= 0’, but the R code for constrOptim reads if (any(ui %*% theta - ci <= 0)) stop("initial value not feasible") The following example shows that when the initial point is on the boundary of the feasibility region, you get the above error message and execution stops. > fn <- function(x) { return(sum(x)) } > > ui <- diag(rep(1,2)) > ci <- matrix(0,nrow=2,ncol=1) > constrOptim( c(0,0), fn, NULL, ui, ci ) Error in optim(theta.old, fun, gradient, control = control, method = method, : function cannot be evaluated at initial parameters > > version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 10.0 year 2009 month 10 day26 svn rev50208 language R version.string R version 2.10.0 (2009-10-26) In contrast, at a different place in constrOptim - the internal function R - the boundary of the feasibility region is allowed: if (any(gi < 0)) return(NaN), and it seems to explicitly allow boundaries at another place: allowing gi==0 and interpreting log(gi) as -Inf. John ... John P. Nolan Math/Stat Department 227 Gray Hall American University 4400 Massachusetts Avenue, NW Washington, DC 20016-8050 jpno...@american.edu 202.885.3140 voice 202.885.3155 fax http://academic2.american.edu/~jpnolan ... __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Re: [Rd] cut takes long time
On Wed, Jun 16, 2010 at 3:56 PM, Gabor Grothendieck wrote: > The following cut command takes nearly 10 seconds on my machine even > though the length of input vector is only 6. I am running on Windows > Vista with C2D BLAS using R 2.11.1. Using the default BLAS and either > R 2.10.1 or "R version 2.12.0 Under development (unstable) (2010-05-31 > r52164)" also gives me results in the 9-11 second range. > I would have expected it to take much less time. > > > tt <- structure(c(631206000, 631206060, 631206180, 631206240, 631206300, > 978224400), class = c("POSIXt", "POSIXct"), tzone = "") > > system.time(cut(tt, "2 hours", include = TRUE)) # 9.45 0.01 9.58 The POSIXt aspect is not relevant to this, it's the number of breakpoints. > system.time(cut(tt, "2 hours", include = TRUE)) user system elapsed 5.884 0.108 6.033 > system.time(cut(rnorm(6), breaks = 5)) user system elapsed 5.200 0.000 5.558 And the time seems linear in the number of breakpoints, which is not surprising. The "Note" section in ?cut does mention more efficient alternatives. Note that > system.time(cut(tt, "2 hours", include = TRUE, labels = FALSE)) user system elapsed 0.020.000.02 so it's the conversion to factors that seems to take most of the time. -Deepayan __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel