Re: [Rd] Call function only when running via R CMD check?

2012-12-18 Thread Henrik Bengtsson
Hi Renaud, On Tue, Dec 18, 2012 at 8:44 AM, Renaud Gaujoux ren...@cbio.uct.ac.za wrote: Hi Henrik (and list), I am interested in a similar feature, and would be happy to see the suggestions you got off-line :) Have you come up with a robust solution, which would work in a variety of

[Rd] How to make an pkg/configure file executable on Windows/NTFS?

2012-12-20 Thread Henrik Bengtsson
Hi, in my package, I've got a 'configure' file in the root, e.g. aroma.affymetrix/configure. (I've also got a configure.win, which works just fine on Windows). This file must be executable (has a proper file mode) for 'R CMD INSTALL'/install.packages() to work, otherwise one gets: * installing

Re: [Rd] Tricking Promises into Sending Info Via Args into Caller

2013-01-12 Thread Henrik Bengtsson
In the spirit of this, but AFAIK not due to lazy evaluation, here's another illustration why it's easy to mistakes when doing inline assignments: x - 0 TRUE (x - 1) [1] TRUE x [1] 1 FALSE (x - 2) [1] FALSE x [1] 1 (x - 3) FALSE [1] FALSE x [1] 3 FALSE (x - 4) [1] FALSE x [1] 4

Re: [Rd] Patch for setwd() to show path in error message

2013-01-12 Thread Henrik Bengtsson
On Fri, Jan 11, 2013 at 10:40 PM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 11/01/2013 20:22, Henrik Bengtsson wrote: Below is a patch for setwd() to show path in error message. Current it just gives error messages such as: Error in setwd(libdir) : cannot change working directory

Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Henrik Bengtsson
On Wed, Jan 16, 2013 at 7:25 AM, Gavin Simpson gavin.simp...@ucl.ac.uk wrote: As a follow-up, shortly after I clicked send I decided to do something silly and rename my ~/.Renviron (which set R_LIBS too). Silly because the Writing R Extensions (WRE) manual says that these startup files are not

Re: [Rd] Trouble building package using R in development

2013-01-16 Thread Henrik Bengtsson
On Wed, Jan 16, 2013 at 8:59 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Wed, Jan 16, 2013 at 7:25 AM, Gavin Simpson gavin.simp...@ucl.ac.uk wrote: As a follow-up, shortly after I clicked send I decided to do something silly and rename my ~/.Renviron (which set R_LIBS too). Silly

[Rd] VignetteBuilder: Unlike other package fields, it does not support version specifiers

2013-02-13 Thread Henrik Bengtsson
Just an observation/FYI on the new DESCRIPTION field 'VignetteBuilder' available in R devel: Unlike other package fields (Depends, Imports and Suggests), VignetteBuilder does not support version specifiers, e.g. VignetteBuilder: R.rsp (= 0.8.2) but only VignetteBuilder: R.rsp If adding a

[Rd] Suggestion: Custom filename patterns for non-Sweave vignettes

2013-02-14 Thread Henrik Bengtsson
Hi, as far as I understand it, the new R devel feature of processing non-Sweave vignettes will (a) locate any [.][RrSs](nw|tex)$ or .Rmd files, (b) check for a registered vignette engine, (c) process the file using the registered weave function, (d) and possibly post process the generated weave

Re: [Rd] Suggestion: Custom filename patterns for non-Sweave vignettes

2013-02-15 Thread Henrik Bengtsson
-Sweave vignettes (without using custom Makefiles), but I find that the supported filename extensions has not been brought along in this move. Thanks again, Henrik Duncan Murdoch On 13-02-14 10:29 PM, Henrik Bengtsson wrote: Hi, as far as I understand it, the new R devel feature

Re: [Rd] Suggestion: Custom filename patterns for non-Sweave vignettes

2013-02-16 Thread Henrik Bengtsson
Hi, as said at the end, all comments are now in the light of R 3.x.0 (x 0). On Fri, Feb 15, 2013 at 11:30 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-02-15 1:53 PM, Henrik Bengtsson wrote: Hi Duncan, thanks you for your prompt reply. On Fri, Feb 15, 2013 at 1:15 AM, Duncan

Re: [Rd] question on why Rigroup package moved to Archive on CRAN

2013-03-09 Thread Henrik Bengtsson
On Sat, Mar 9, 2013 at 12:25 PM, Kevin Hendricks kevin.hendri...@sympatico.ca wrote: Hi, Who should I ask about my package Rigroup_0.83 being moved to Archive status on CRAN and no longer available via install.package? I have no problems with the move if this was simply because of low

Re: [Rd] Failed to locate 'weave' output file / vignette product does not have a known filename extension

2013-03-13 Thread Henrik Bengtsson
Hi, I contributed code to R r62130 which may be responsible for that (not sure). I'll investigate as soon as got the time. /Henrik On Wed, Mar 13, 2013 at 10:17 AM, Dan Tenenbaum dtene...@fhcrc.org wrote: Hello, I'm seeing three different vignette-related errors with recent versions of

Re: [Rd] Failed to locate 'weave' output file / vignette product does not have a known filename extension

2013-03-15 Thread Henrik Bengtsson
, 2013 at 1:16 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I contributed code to R r62130 which may be responsible for that (not sure). I'll investigate as soon as got the time. /Henrik On Wed, Mar 13, 2013 at 10:17 AM, Dan Tenenbaum dtene...@fhcrc.org wrote: Hello, I'm seeing

Re: [Rd] missing exported methods when compiling vignettes in R 3.0.0 RC

2013-04-01 Thread Henrik Bengtsson
Hi, things have indeed changed on how non-Sweave vignettes are built (this happened around R devel 2013-03-05 r62130). However, it's not clear to me what changes would be behind your problems, if any. Build your vignette with the following buildVignette(), which emulates what R does when it

Re: [Rd] R 3.0.0: wrong MD5 checksums for Windows?

2013-04-04 Thread Henrik Bengtsson
I can reproduce this (same setup): require(tools); checkMD5sums(dir=R.home()); It's a '\n' - '\r\n' issue: filename - etc/Rconsole; md5 - readLines(file.path(R.home(), MD5)); md5 - grep(filename, md5, value=TRUE); md5 - gsub( .*, , md5); print(md5); [1] 35d6d6cf7957492f78f50c435e36f08e

Re: [Rd] R 3.0.0: wrong MD5 checksums for Windows?

2013-04-04 Thread Henrik Bengtsson
On Thu, Apr 4, 2013 at 12:10 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 04/04/2013 2:38 PM, Tal Galili wrote: Hello dear R-devel, When installing R 3.0.0 on Windows 7, and then running: require(tools) checkMD5sums(dir=R.home()) I get the following massage: files

[Rd] parallel: Race-condition concern regarding graphics devices in a multi-thread environment

2013-04-05 Thread Henrik Bengtsson
Hi, I'm trying to figure out how to safely make sure that I close the same graphics device that I opened earlier in a thread (and not one opened by a parallel thread). In a *single-thread* environment, one can do the following to open and close a device: makePlot - function(i) { filename -

Re: [Rd] parallel: Race-condition concern regarding graphics devices in a multi-thread environment

2013-04-06 Thread Henrik Bengtsson
] Error in x11() : a forked child should not open a graphics device\n ## [[2]] ## [1] Error in x11() : a forked child should not open a graphics device\n Thanks for your help Simon, Henrik Cheers, Simon On Apr 5, 2013, at 12:23 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'm

Re: [Rd] Publishing my Package on CRAN

2013-04-20 Thread Henrik Bengtsson
If you're not aware of it, you should know of: http://cran.r-project.org/web/packages/policies.html /Henrik On Sat, Apr 20, 2013 at 8:42 AM, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 19.04.2013 06:38, liuyipei wrote: Hi, I have a simple package with two functions. It

Re: [Rd] R 3.0, Rtools3.0,l Windows7 64-bit, and permission agony

2013-04-21 Thread Henrik Bengtsson
I (as well) keep a specific Rsetup.bat file for launching Windows cmd.exe with the proper PATH etc setup for build R packages etc. It's only after this thread I gave it a second thought; you can indeed temporarily set the PATH via ~/.Rprofile or ~/.Renviron, which *are* processed at the very

Re: [Rd] vignettes: problems with PDF compaction

2013-04-22 Thread Henrik Bengtsson
It's certainly not obvious, but you should use 'gswin32c.exe' instead of 'gswin32.exe'. From http://ghostscript.com/doc/current/Install.htm#Install_Windows GSWIN32C.EXE Ghostscript as a 32-bit Windows command line program. This is usually the preferred executable. GSWIN32.EXE 32-bit Ghostscript

[Rd] Code compilation: Drop certain statements in a function before calling it multiple times?

2013-05-23 Thread Henrik Bengtsson
Hi, I make heavy use of verbose statements in my code, verbose output that can be enabled/disabled via an argument. Here is a dummy example: foo - function(n=10, verbose=FALSE) { res - 0; for (k in 1:n) { if (verbose) cat(Iteration , k, ...\n, sep=); res - res + k; if

[Rd] Assigning NULL to large variables is much faster than rm() - any reason why I should still use rm()?

2013-05-25 Thread Henrik Bengtsson
Hi, in my packages/functions/code I tend to remove large temporary variables as soon as possible, e.g. large intermediate vectors used in iterations. I sometimes also have the habit of doing this to make it explicit in the source code when a temporary object is no longer needed. However, I did

Re: [Rd] Assigning NULL to large variables is much faster than rm() - any reason why I should still use rm()?

2013-05-25 Thread Henrik Bengtsson
On Sat, May 25, 2013 at 4:38 PM, Simon Urbanek simon.urba...@r-project.org wrote: On May 25, 2013, at 3:48 PM, Henrik Bengtsson wrote: Hi, in my packages/functions/code I tend to remove large temporary variables as soon as possible, e.g. large intermediate vectors used in iterations. I

Re: [Rd] tests conditioned on CRAN?

2013-07-01 Thread Henrik Bengtsson
On CRAN servers or R CMD check --as-cran? I assume you mean the former. The way I do it is the other way around, i.e. to condition on running locally or not such that the default is not to run or to run a smaller test case: if (Sys.getenv(_R_CHECK_FULL_) == ) { # Default/no test } else { #

Re: [Rd] Redirect system2 stdout to a file on windows

2013-07-14 Thread Henrik Bengtsson
Works for me (Win 7 64bit) using R.exe: setwd(tempdir()) getwd() [1] C:/Users/hb/AppData/Local/Temp/RtmpSqjCDt res - system2(whoami, stdout=out.txt, stderr=err.txt) res [1] 0 file.info(c(out.txt, err.txt)) size isdir mode mtime ctime out.txt 12 FALSE

[Rd] R -e crashes on Windows (but not Rterm -e )

2013-07-28 Thread Henrik Bengtsson
On Windows, the following crashes R for Windows terminal front-end: R -e whereas Rterm -e or R -e (a space in the expression) doesn't. I observe this on: - R Under development (unstable) (2013-07-26 r63419) [Platform: x86_64-w64-mingw32/x64 (64-bit)] - R version 3.0.1 Patched (2013-07-25

[Rd] Core dump with R --encoding=foo -e 1 (non-existing encoding)

2013-07-28 Thread Henrik Bengtsson
Trying to launch R with a *non-existing* encoding core dumps/crashes, e.g. R --encoding=foo -e 1. EXAMPLES: R --encoding=foo -e 1 R version 3.0.1 (2013-05-16) -- Good Sport Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin10.8.0 (64-bit) [...] ***

Re: [Rd] Core dump with R --encoding=foo -e 1 (non-existing encoding)

2013-07-28 Thread Henrik Bengtsson
On Sun, Jul 28, 2013 at 10:39 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-07-28 1:31 PM, Henrik Bengtsson wrote: Trying to launch R with a *non-existing* encoding core dumps/crashes, e.g. R --encoding=foo -e 1. EXAMPLES: R --encoding=foo -e 1 R version 3.0.1 (2013-05-16

Re: [Rd] R -e crashes on Windows (but not Rterm -e )

2013-07-28 Thread Henrik Bengtsson
On Sun, Jul 28, 2013 at 10:22 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Windows, the following crashes R for Windows terminal front-end: R -e whereas Rterm -e or R -e (a space in the expression) doesn't. I observe this on: - R Under development (unstable) (2013-07-26

[Rd] Adding text comments to graphics device output files?

2013-07-30 Thread Henrik Bengtsson
Hi, several image file format supports textual/meta data comments in one way or the other. For me an obvious usage would be to add sessionInfo() information to PNG and PDF image files, ideally from within R although external tools would work as well(*). Has anyone looked into this or have any

Re: [Rd] Adding text comments to graphics device output files?

2013-07-30 Thread Henrik Bengtsson
...@ucdavis.edu wrote: Hi Henrik I have some extensions of Simon U's png package to read and write metadata elements for PNG. They are at https://github.com/duncantl/png.git When I have time to completely test them, maybe Simon may incorporate them. D. On 7/30/13 7:59 PM, Henrik

Re: [Rd] Adding text comments to graphics device output files?

2013-08-01 Thread Henrik Bengtsson
Thank you both. It works like a charm (tried it on Windows). /Henrik On Wed, Jul 31, 2013 at 7:17 AM, Simon Urbanek simon.urba...@r-project.org wrote: On Jul 31, 2013, at 12:12 AM, Henrik Bengtsson wrote: Hi Duncan, this is perfect timing. Your https://github.com/duncantl/png/blob/master

Re: [Rd] isOpen on closed connections

2007-11-15 Thread Henrik Bengtsson
My solution the original post is to always set 'con - NULL' after closing a connection, and then test for NULL. This is how I do to make sure to make sure that opened connections are closed and as soon as possible. foo - function(...) { con - file(foo.R, open=r): on.exit({ if

Re: [Rd] C/C++ 'assert' should not be used in R packages

2007-11-16 Thread Henrik Bengtsson
On Nov 10, 2007 1:27 PM, Simon Urbanek [EMAIL PROTECTED] wrote: On Nov 10, 2007, at 1:05 PM, Duncan Murdoch wrote: On 10/11/2007 1:00 PM, Duncan Temple Lang wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Duncan Murdoch wrote: Prof Brian Ripley wrote: Please don't use

Re: [Rd] seq() does not create proper numbers (PR#10489)

2007-12-04 Thread Henrik Bengtsson
On 04/12/2007, Duncan Murdoch [EMAIL PROTECTED] wrote: On 12/4/2007 7:10 AM, [EMAIL PROTECTED] wrote: Full_Name: Rico Ihle Version: 2.6.1 OS: Windows XP Professional Version 2002 Pentium(R) 4 CPU 3.2 GHz Submission from: (NULL) (134.76.183.24) This is not a bug. See FAQ 7.31, Why

Re: [Rd] Defaults for postscript()

2007-12-06 Thread Henrik Bengtsson
On 06/12/2007, Marc Schwartz [EMAIL PROTECTED] wrote: On Thu, 2007-12-06 at 00:32 -0800, Deepayan Sarkar wrote: On 12/6/07, Prof Brian Ripley [EMAIL PROTECTED] wrote: The defaults for postscript() paper = default onefile = TRUE horizontal = TRUE (it seems) date from the

Re: [Rd] readBin differences on Windows and Linux/mac

2008-01-01 Thread Henrik Bengtsson
Also make sure the problem is not due to downloading a gzip file in text mode, because to the best of my understanding that is platform dependent. That is, use download.file(..., mode=wb) instead of the default, which is mode=w. (This is such a common error that I would like to suggest mode=wb

Re: [Rd] readBin differences on Windows and Linux/mac

2008-01-01 Thread Henrik Bengtsson
On 01/01/2008, Henrik Bengtsson [EMAIL PROTECTED] wrote: Also make sure the problem is not due to downloading a gzip file in text mode, because to the best of my understanding that is platform dependent. That is, use download.file(..., mode=wb) instead of the default, which is mode=w

Re: [Rd] checking whether the name space can be loaded with stated dependencies

2008-01-04 Thread Henrik Bengtsson
On 04/01/2008, hadley wickham [EMAIL PROTECTED] wrote: On 1/4/08, Prof Brian Ripley [EMAIL PROTECTED] wrote: What it is trying is % env R_DEFAULT_PACKAGES=NULL R loadNamespace(ggplot2) The test is not new, so it would seem to be a change in ggplot2 since the version on CRAN. My

[Rd] Great tool

2008-01-20 Thread Henrik Bengtsson
Hi, I just have drop a note to say that the 'codetools' (and the part of R CMD check that use it) is a pleasure to use and saves me from hours of troubleshooting. Each time it finds something I am amazed how accurate it is. Thanks to Luke T. and everyone else involved in creating it. Cheers,

[Rd] Misinformative error message for vector()

2008-01-20 Thread Henrik Bengtsson
Nothing serious, but I just noticed that if you pass a function as the 'length' argument of vector(), you get the following misinformative error message: vector(list, length=function() {}) Error in vector(list, length = function() { : negative length vectors are not allowed whereas if you for

Re: [Rd] Understanding an R improvement that already occurred.

2008-01-30 Thread Henrik Bengtsson
On Jan 30, 2008 7:20 AM, Jay Emerson [EMAIL PROTECTED] wrote: I was surprised to observe the following difference between 2.4.1 and 2.6.0 after a long overdue upgrade a few months ago of our departmental server. It wasn't a bug fix, but a subtle improvement. Here's the simplest example I

Re: [Rd] Need for garbage collection after creating object

2008-02-05 Thread Henrik Bengtsson
On Feb 5, 2008 8:01 AM, Iago Mosqueira [EMAIL PROTECTED] wrote: Hello, After experiencing some difficulties with large arrays, I was surprised to see the apparent need for class to gc() after creating fairly large arrays. For example, calling a-array(2, dim=c(10,10,10,10,10,100)) makes

Re: [Rd] Need for garbage collection after creating object

2008-02-05 Thread Henrik Bengtsson
On Feb 5, 2008 10:12 AM, Henrik Bengtsson [EMAIL PROTECTED] wrote: On Feb 5, 2008 8:01 AM, Iago Mosqueira [EMAIL PROTECTED] wrote: Hello, After experiencing some difficulties with large arrays, I was surprised to see the apparent need for class to gc() after creating fairly large arrays

Re: [Rd] Uninstall registry key the same for all versions (PR#10746)

2008-02-12 Thread Henrik Bengtsson
This is a beautiful example on how an added feature matures into a bug over time :) I let the Windows developers argue with the pro's and con's of your suggestion. I just wanna add a related suggestion that when you have multiple installations and you run Unistall R 2.6.0 the first dialog ('R

[Rd] Best way to reset random seed when using set.seed() in a function?

2008-02-13 Thread Henrik Bengtsson
Hi, this is related to a question just raised on Bioconductor where one function sets the random seed internally but never resets it, which results in enforced down streams random samples being deterministic. What is the best way to reset the random seed when you use set.seed() within a

Re: [Rd] Best way to reset random seed when using set.seed() in a function?

2008-02-13 Thread Henrik Bengtsson
On Feb 13, 2008 9:32 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 13 Feb 2008, Henrik Bengtsson wrote: Hi, this is related to a question just raised on Bioconductor where one function sets the random seed internally but never resets it, which results in enforced down streams

Re: [Rd] Best way to reset random seed when using set.seed() in a function?

2008-02-13 Thread Henrik Bengtsson
the seed, if you are going to try to reproduce results.) Thanks for this note. This seems much more natural to work with than '.Random.seed'. /Henrik Paul Henrik Bengtsson wrote: Hi, this is related to a question just raised on Bioconductor where one function sets the random seed

Re: [Rd] Vector binding on harddisk

2008-02-14 Thread Henrik Bengtsson
On Thu, Feb 14, 2008 at 8:18 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 2/14/2008 10:54 AM, Henrik Bengtsson wrote: On Thu, Feb 14, 2008 at 7:23 AM, Jeffrey Horner [EMAIL PROTECTED] wrote: Paul Gilbert wrote on 02/14/2008 09:14 AM: _ wrote: Hi all, Using big

[Rd] Feedback on a colClasses() generator function in progress?

2008-02-21 Thread Henrik Bengtsson
I'm working on colClasses() function that generates colClasses vectors for read.table() using a compact format string (see below). The below is what I got right now. Before adding it to R.utils, I would like to check with you if I'm missing something obvious such as certain column classes, if

[Rd] Unix-like touch to update modification timestamp of file?

2008-02-26 Thread Henrik Bengtsson
Hi, is it possible to update the modification time stamp of a file using R (on file systems supporting it)? It is sufficient to update the modification time to the current time. The best I can do for now is: touchFile - function(pathname, ...) { if (!file.exists(pathname)) stop(No such

[Rd] Warnings generated by log2()/log10() are really large/takes a long time to display

2008-02-26 Thread Henrik Bengtsson
x - rnorm(1e6); y - log(x); # or logb(x) or log1p(x) w - warnings(); print(object.size(w)); ## [1] 480 str(w); $ NaNs produced: language log(x) - attr(*, dots)= list() - attr(*, class)= chr warnings y - log2(x); # or log10(x) w - warnings(); print(object.size(w)); ## [1] 8000536 str(w); ##

Re: [Rd] Warnings generated by log2()/log10() are really large/takes a long time to display

2008-02-27 Thread Henrik Bengtsson
On Wed, Feb 27, 2008 at 12:56 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 27 Feb 2008, Martin Maechler wrote: Thank you Henrik, HenrikB == Henrik Bengtsson [EMAIL PROTECTED] on Tue, 26 Feb 2008 22:03:24 -0800 writes: {with many superfluous empty statements ( i.e

Re: [Rd] Unix-like touch to update modification timestamp of file?

2008-02-27 Thread Henrik Bengtsson
. Henrik On Wed, Feb 27, 2008 at 11:12 AM, Earl F. Glynn [EMAIL PROTECTED] wrote: Henrik Bengtsson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... is it possible to update the modification time stamp of a file using R (on file systems supporting

Re: [Rd] invalid regular expression '[a-Z]'

2008-03-05 Thread Henrik Bengtsson
On Wed, Mar 5, 2008 at 6:40 PM, Henrik Bengtsson [EMAIL PROTECTED] wrote: On Wed, Mar 5, 2008 at 6:18 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 05/03/2008 8:56 PM, Henrik Bengtsson wrote: Hi, just curious, but does anyone know the source/reason of observing

Re: [Rd] invalid regular expression '[a-Z]'

2008-03-06 Thread Henrik Bengtsson
On Wed, Mar 5, 2008 at 11:09 PM, Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 5 Mar 2008, Henrik Bengtsson wrote: On Wed, Mar 5, 2008 at 6:18 PM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 05/03/2008 8:56 PM, Henrik Bengtsson wrote: Hi, just curious, but does anyone know

[Rd] Argument nomatch matched by multiple actual arguments ... %in% - match?!?

2008-03-06 Thread Henrik Bengtsson
When I run R CMD check R.oo on R v2.7.0 devel (2008-03-04 r44677) on WinXP I get the following error while testing examples: Error in match(x, table, nomatch = 0) : formal argument nomatch matched by multiple actual arguments Calls: setMethodS3 - setMethodS3.default - %in% - match Execution

Re: [Rd] Memory allocation error in 2.6.2 (PR#10903)

2008-03-06 Thread Henrik Bengtsson
Before submitting a bug report, it is probably wise to bring it up on r-devel first. Remember, someone has to clean out all those false bug reports manually. There are so many potential reasons for your problem, which indicates fragmented memory allocations. One obvious one is that one of the

Re: [Rd] Argument nomatch matched by multiple actual arguments ... %in% - match?!?

2008-03-06 Thread Henrik Bengtsson
, table) match(x, table, nomatch = 0) 0 environment: namespace:base except that the 'nomatch' argument is not named in is.element(). Also, none of calls used variable names 'x', 'table', 'el', 'set', or 'nomatch'. /Henrik On Thu, Mar 6, 2008 at 2:27 AM, Henrik Bengtsson [EMAIL PROTECTED] wrote

[Rd] Read/write file locking mechanism using SQL?

2008-04-30 Thread Henrik Bengtsson
Hi, I've got data stored in multiple files on a shared file system. I wish to have multiple processes/hosts read and write to these files simultaneously. When a process wish to write to a file no other processes may write to nor read from the file. If no process is writing to the file, any

Re: [Rd] S4 generic for lowess

2008-05-20 Thread Henrik Bengtsson
A quick comment on design: On Tue, May 20, 2008 at 1:41 AM, Iago Mosqueira [EMAIL PROTECTED] wrote: Hi, A lowess method is defined in our package for one of our S4 classes. To explicitely define the generic this is being used if (!isGeneric(lowess)) setGeneric(lowess, useAsDefault =

Re: [Rd] image (PR#11493)

2008-05-21 Thread Henrik Bengtsson
On Tue, May 20, 2008 at 5:05 PM, [EMAIL PROTECTED] wrote: Full_Name: Joseph Scandura Version: 2.7.0 OS: Mac 10.5 Submission from: (NULL) (140.251.50.94) Since updating to 2.7.0 all plots that use image() (heatmap, etc...) now draw visible boxes around each rectangle in the plot. When

[Rd] rawToChar(raw(0))

2008-05-21 Thread Henrik Bengtsson
Hi, right now we have (on R v2.7.0 patched (2008-04-23 r45466)) that: rawToChar(raw(0)) [1] rawToChar(raw(0), multiple=TRUE) character(0) Is this intended or should both return character(0)? Personally, I would prefer that an empty input vector returns an empty output vector. Same should

Re: [Rd] rowSums()/colSums() don't preserve the 'integer' storage mode

2008-07-17 Thread Henrik Bengtsson
I had a look at the source code and the coercion to double is only done one the sum of each row/column, so the overhead (e.g. memory) is only on the summed result. The integer matrix is *not*coerced to double before summing, which could be case if done before calling the native code. The latter

Re: [Rd] rowSums()/colSums() don't preserve the 'integer' storage mode

2008-07-17 Thread Henrik Bengtsson
Hi, there is one more thing to consider: the risk of getting integer overflow. Should that be ignored? How is this handled by sum()? I think it is good if {col|row}Sums() would return the same data type as the input object. Cheers Henrik On Thu, Jul 17, 2008 at 6:32 PM, Herve Pages [EMAIL

[Rd] Clash between 'Cairo' and 'EBImage' packages on Windows

2008-07-19 Thread Henrik Bengtsson
Hi, on Windows XP Pro with R version 2.7.1 Patched (2008-06-27 r46012) the 'Cairo' and the 'EBImage' packages does not play well together. Loading EBImage before Cairo cause the following to happen: # Rterm --vanilla library(EBImage); library(Cairo) Error in inDL(x, as.logical(local),

[Rd] R CMD check test examples with and without Suggest installed

2008-07-20 Thread Henrik Bengtsson
Hi, is there a way to have R CMD check test the example():s twice, once with all Suggest package hidden or once, if $R_check_force_suggests=1, with all Suggest available? BACKGROUND: I just had a case where my R.matlab package passed all R CMD checks on my local machine, but when I uploaded it

[Rd] serialize() to via temporary file is heaps faster than doing it directly (on Windows)

2008-07-24 Thread Henrik Bengtsson
Hi, FYI, I just notice that on Windows (but not Linux) it is orders of magnitude (below it's 50x) faster to serialize() and object to a temporary file and then read it back, than to serialize to an object directly. This has for instance impact on how fast digest::digest() can provide a checksum.

Re: [Rd] C versions of serialize/unserialize in packages

2008-07-31 Thread Henrik Bengtsson
Hi, On Thu, Jul 31, 2008 at 6:35 AM, Roger D. Peng [EMAIL PROTECTED] wrote: Are the functions 'R_Unserialize' and 'R_InitFileInPStream' allowed to be used in R packages? I guess I'm just not clear on the implications of this comment in 'Rinternals.h': /* The connection interface is not yet

Re: [Rd] Suggestion: 20% speed up of which() with two-character mod

2008-08-04 Thread Henrik Bengtsson
context information, e.g. -C 3? /Henrik On Fri, Jul 11, 2008 at 8:57 AM, Charles C. Berry [EMAIL PROTECTED] wrote: On Thu, 10 Jul 2008, Henrik Bengtsson wrote: Hi, by replacing 'll' with 'wh' in the source code for base::which() one gets ~20% speed up for *named logical vectors*. The amount

Re: [Rd] Suggestion: 20% speed up of which() with two-character mod

2008-08-05 Thread Henrik Bengtsson
Hi, thanks for this. I'll use unified diff next time, i.e. diff -u current.R new.R /Henrik On Tue, Aug 5, 2008 at 5:54 AM, Martin Maechler [EMAIL PROTECTED] wrote: HenrikB == Henrik Bengtsson [EMAIL PROTECTED] on Mon, 4 Aug 2008 21:14:12 -0700 writes: HenrikB Hi, HenrikB I

Re: [Rd] Constructor blah() vs. as.blah()

2008-08-15 Thread Henrik Bengtsson
This thread is going to be a lot about matter of tastes, but at least I would think of blah() as a constructor function and as.blah() as a coerce function. There should always be one constructor function, but providing coerce functions is optional. Furthermore, the constructor function should

[Rd] Can the file locking in filehash be reused? (Was: Re: [R] [R-pkgs] filehash 2.0)

2008-08-28 Thread Henrik Bengtsson
Hi (Roger), I saw the announcement of filehash v2.0 and the sentence This development has lead to better file locking for concurrent access and faster reading and writing of data in general caught my attention. What kind of file locking do you refer to here? I am looking for a mechanism that can

Re: [Rd] serialize() to via temporary file is heaps faster than doing it directly (on Windows)

2008-08-29 Thread Henrik Bengtsson
I just want to re-post this thread in case it slipped through the summer sieve of someone that might be interested and/or has a real solution beyond my serialize2() patch. Cheers Henrik On Thu, Jul 24, 2008 at 8:10 PM, Henrik Bengtsson [EMAIL PROTECTED] wrote: Hi, FYI, I just notice

Re: [Rd] Bug in base::mean.default ? (PR#12984)

2008-09-23 Thread Henrik Bengtsson
Not a bug. There is a statement in base::mean.default() before this if (na.rm) x - x[!is.na(x)] that removes any missing values. Thus, it is known that there are no missing values beyond this statement. /Henrik On Tue, Sep 23, 2008 at 8:25 AM, [EMAIL PROTECTED] wrote: In the

Re: [Rd] splitting strings efficiently

2008-09-24 Thread Henrik Bengtsson
For strsplit(), note that fixed=TRUE is much faster. /HB On Wed, Sep 24, 2008 at 9:20 AM, Mark Kimpel [EMAIL PROTECTED] wrote: I knew there HAD to be a basic function, but 'help.search(split string)' and 'help(string) did not find it. Thanks for the help on this elementary question. Mark

[Rd] as.list() for function:s

2008-10-16 Thread Henrik Bengtsson
Hi, a quick comment. I just notice that as.list() deals with function:s the old way inside the default function, cf. as.list.default function (x, ...) { if (typeof(x) == list) return(x) if (is.function(x)) return(c(formals(x), list(body(x .Internal(as.vector(x,

[Rd] file.access() on network (mounted) drive on Windows Vista?

2008-11-26 Thread Henrik Bengtsson
Hi, I have a writable and readable file on a small network file system (Cisco NSLU2 Unslung; non-NTFS) that I access via a mounted drive on Windows Vista. My problem could be due to a funny file system/server, but here it goes: pathname - Q:/foo.txt cat(file=pathname, Hello world!\n)

Re: [Rd] file.access() on network (mounted) drive on Windows Vista?

2008-12-01 Thread Henrik Bengtsson
OS with multiple filesystems potentially has problems like this: we saw them with Unix (Solaris) file systems mounted on MacOS X via Samba, even when the same thing works correctly on Linux.) On Wed, 26 Nov 2008, Henrik Bengtsson wrote: Hi, I have a writable and readable file on a small

Re: [Rd] package development

2008-12-12 Thread Henrik Bengtsson
Using parse() is better for syntax errors; pathnames - list.files(path=pkg/R, pattern=[.](r|R|s|S)$, full.names=TRUE); for (pathname in pathnames) parse(pathname) /Henrik On Thu, Dec 11, 2008 at 4:00 PM, Duncan Murdoch murd...@stats.uwo.ca wrote: On 11/12/2008 6:04 PM, Terry Therneau wrote:

[Rd] x - 1:2; dim(x) - 2? A vector or not?

2009-01-12 Thread Henrik Bengtsson
Ran into the follow intermediate case in an external package (w/ recent R v2.8.1 patched and R v2.9.0 devel): x - 1:2 dim(x) - 2 dim(x) [1] 2 x [1] 1 2 str(x) int [, 1:2] 1 2 nrow(x) [1] 2 ncol(x) [1] NA is.vector(x) [1] FALSE is.matrix(x) [1] FALSE is.array(x) [1] TRUE x[1] [1] 1

Re: [Rd] x - 1:2; dim(x) - 2? A vector or not?

2009-01-13 Thread Henrik Bengtsson
then argue that [1:10,] is somewhat better than [,1:10], but that is just polish. /Henrik I think these days we have enough internal glue in place that an end user would not notice the difference (but those working at C level with R objects may need to know). On Mon, 12 Jan 2009, Henrik Bengtsson

Re: [Rd] Windows installer text bug (PR#13445)

2009-01-14 Thread Henrik Bengtsson
On Tue, Jan 13, 2009 at 4:30 PM, robert.e.cranf...@boeing.com wrote: Hey, this guy builds engines for aircraft *and* uses freeware! I was on such a jet just few days ago and I can confirm that I did not notice anything strange (except the food). Full_Name: Rob Cranfill Version: 2.8.1 OS:

Re: [Rd] More intensive checking of R help files

2009-01-15 Thread Henrik Bengtsson
Hi, this sounds all good. One comment below: On Fri, Jan 9, 2009 at 1:25 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: We have been working on handling Rd (R help) files with R rather than Perl scripts. As part of that work, Duncan has written a parser which has revealed many problems

[Rd] Package impute exist in quite different version on CRAN and BioC

2009-01-23 Thread Henrik Bengtsson
[CC:ing package maintainer of 'impute' package and crossposting to r-devel and bioc-devel because this affects both audiences] Hi, the 'impute' package is published both on CRAN and Bioconductor; http://cran.r-project.org/web/packages/impute/

[Rd] Flag '#' in sprintf() gives an error in R v2.9.0 devel

2009-02-02 Thread Henrik Bengtsson
Hi, in R v2.8.1 patched (2008-12-22 r47296) the following works: sprintf(%#x, 1) [1] 0x1 whereas in R v2.9.0 devel (2009-01-08 r47515) it gives: sprintf(%#x, 1); Error in sprintf(%#x, 1) : use format %f, %e, %g or %a for numeric objects Not sure if this was an intended move or not.

[Rd] R v2.1.0 patched (2005-05-09) for Windows?

2005-07-15 Thread Henrik Bengtsson
to me what you get and what is your version of R? Thanks a lot! Note that this is most likely *not* due to R.oo (no native code) - my wild guess is that it has to do with a memory leak in the code for environments or regular expressions. Thanks Henrik Bengtsson

Re: [Rd] Memory leakage/violation?

2005-08-27 Thread Henrik Bengtsson
to replace the f771.exe? Uwe -thomas On Fri, 26 Aug 2005, Henrik Bengtsson wrote: Hi, I've spotted a possible memory leakage/violation in the latest R v2.1.1 patched and R v2.2.0dev on Windows XP Pro SP2 Eng. I first caught it deep down in a nested svd algorithm when

Re: [Rd] Memory leakage/violation?

2005-08-27 Thread Henrik Bengtsson
the error today after a fresh reboot (and letting the computer rest for 12 hours). Best Henrik Uwe -thomas On Fri, 26 Aug 2005, Henrik Bengtsson wrote: Hi, I've spotted a possible memory leakage/violation in the latest R v2.1.1 patched and R v2.2.0dev on Windows XP Pro SP2

Re: [Rd] Memory leakage/violation?

2005-08-27 Thread Henrik Bengtsson
Brian for making me aware of this by mentioning a possible broken DLL. Thanks you all for taking the time on this one Henrik Henrik Bengtsson wrote: Prof Brian Ripley wrote: On Sat, 27 Aug 2005, Uwe Ligges wrote: Thomas Lumley wrote: I can't reproduce this on R2.2.0dev on Windows XP

[Rd] Tracebacks with tryCatch() and withCallingHandlers()?

2005-09-07 Thread Henrik Bengtsson
When batch processing analysis, I use tryCatch() for failure handling and to prevent unwanted interrupts. I write detailed progress to log file and conditions (warnings and errors) are written to the same log file immediately by using withCallingHandlers(..., condition=function(c) cat(c,

[Rd] Request: read.table() - argument 'flush' to be passed to scan()

2005-11-09 Thread Henrik Bengtsson
Hi, would it be possible to add an argument 'flush' to read.table(), which is passed as internal scan(..., 'flush=flush') calls? BACKGROUND: The microarray image analysis software QuantArray, sometimes generates tab-delimited files that contain data rows with trailing and obsolete TAB's (for

[Rd] x[1,], x[1,,], x[1,,,], ...

2005-11-23 Thread Henrik Bengtsson
Hi, is there a function in R already doing what I try to do below: # Let 'x' be an array with *any* number of dimensions (=1). x - array(1:24, dim=c(2,2,3,2)) ... x - array(1:24, dim=c(4,3,2)) i - 2:3 ndim - length(dim(x)) if (ndim == 1) y - x[i] else if (ndim == 2) y - x[i,] else if

Re: [Rd] Infinite recursion in S3 methods crashes R on windows (related to PR#8203?)

2005-11-23 Thread Henrik Bengtsson
Hi, trying the same on WinXP I get :R 2.1.1 Patched (2005-09-19) myf(1) Error: protect(): protection stack overflow R 2.2.0 Patched (2005-11-21 r36410): myf(1) Error: evaluation nested too deeply: infinite recursion / options(expressions=)? options(expressions=5) myf(1) Error:

Re: [Rd] x[1,], x[1,,], x[1,,,], ...

2005-11-23 Thread Henrik Bengtsson
Hi, thanks everyone. Some comments below: Peter Dalgaard wrote: Henrik Bengtsson [EMAIL PROTECTED] writes: Hi, is there a function in R already doing what I try to do below: # Let 'x' be an array with *any* number of dimensions (=1). x - array(1:24, dim=c(2,2,3,2)) ... x - array(1:24, dim

Re: [Rd] list.files(recursive=T) does not return directory names

2005-11-25 Thread Henrik Bengtsson
Hi, the R.utils package has a function listDirectory() that returns the directory names too. (I've made some changes to the function recently, which is not in the CRAN version, so get it from http://www.braju.com/R/ instead.) The package also has isFile() and isDirectory() to test if a

[Rd] CRAN and R v2.2.1 for Windows

2005-12-21 Thread Henrik Bengtsson
Thanks for the new updates in v2.2.1. I just noticed a few problems on http://cran.r-project.org/bin/windows/base/. 1) The CHANGES and NEWS files for v2.2.1 does not include info on v2.2.1 but only details up until v2.2.0, cf. http://cran.r-project.org/src/base/NEWS 2) The patched version is

[Rd] R CMD build: Subdirectory 'R' contains invalid file names

2006-02-10 Thread Henrik Bengtsson
Hi, I get * excluding invalid files from 'R.oo' Subdirectory 'R' contains invalid file names: attachLocally.Object.Rex Exception.Rex extend.default.Rex InternalErrorException.reportBug.Rex Package.Rex Person.Rex Rdoc.Rex setMethodS3.Rex StaticFields.Rex when running R CMD build in R v2.3.0

Re: [Rd] R CMD build: Subdirectory 'R' contains invalid file names

2006-02-10 Thread Henrik Bengtsson
Hi, On 2/10/06, Kurt Hornik [EMAIL PROTECTED] wrote: Henrik Bengtsson writes: Hi, I get * excluding invalid files from 'R.oo' Subdirectory 'R' contains invalid file names: attachLocally.Object.Rex Exception.Rex extend.default.Rex InternalErrorException.reportBug.Rex Package.Rex

<    1   2   3   4   5   6   7   8   9   10   >