Re: [Rd] proper use of reg.finalizer to close connections

2014-10-27 Thread Henrik Bengtsson
: finalizerFunction - ## cleanup code reg.finalizer(parent.env(), finalizerFunction) -m On Oct 26, 2014 11:03 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Sun, Oct 26, 2014 at 8:14 PM, Murat Tasan mmu...@gmail.com wrote: Ah (again)! Even with my fumbling presentation of the issue, you

[Rd] OSX Yosemite (10.10): Are package binaries the same as for OSX Mavericks (10.9)?

2014-10-27 Thread Henrik Bengtsson
I'm trying to help someone to troubleshoot possible OSX Yosemite issues, but I've only got access to OSX ( 10.9) so I cannot check myself. When building/installing binary R packages, there are different binaries depending on OSX version. For instance, CRAN provides different binaries for 'OS X

Re: [Rd] OSX Yosemite (10.10): Are package binaries the same as for OSX Mavericks (10.9)?

2014-10-27 Thread Henrik Bengtsson
On Mon, Oct 27, 2014 at 11:23 AM, Dan Tenenbaum dtene...@fredhutch.org wrote: - Original Message - From: Dan Tenenbaum dtene...@fredhutch.org To: Henrik Bengtsson h...@biostat.ucsf.edu Cc: R-devel r-devel@r-project.org Sent: Monday, October 27, 2014 11:21:59 AM Subject: Re: [Rd

Re: [Rd] OSX Yosemite (10.10): Are package binaries the same as for OSX Mavericks (10.9)?

2014-10-28 Thread Henrik Bengtsson
On Mon, Oct 27, 2014 at 12:33 PM, Dan Tenenbaum dtene...@fredhutch.org wrote: - Original Message - From: Henrik Bengtsson h...@biostat.ucsf.edu To: Dan Tenenbaum dtene...@fredhutch.org Cc: R-devel r-devel@r-project.org Sent: Monday, October 27, 2014 12:21:49 PM Subject: Re: [Rd

[Rd] Milestone: 6000 packages on CRAN

2014-10-29 Thread Henrik Bengtsson
Another 1000 packages were added to CRAN and this time in less than 12 months. Today (2014-10-29) on The Comprehensive R Archive Network (CRAN) [1]: Currently, the CRAN package repository features 6000 available packages. Going from 5000 to 6000 packages took 355 days - which means that it's on

Re: [Rd] Citation if copying R base code

2014-11-06 Thread Henrik Bengtsson
On Nov 6, 2014 3:36 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 06/11/2014, 5:57 AM, Peter Meissner wrote: Dear Listeners, ... also I read the CRAN policies and tried to solve those questions myself I feel very much in the need of good advise ... I am currently finishing

Re: [Rd] How to maintain memory in R extension

2014-11-12 Thread Henrik Bengtsson
On Wed, Nov 12, 2014 at 10:20 AM, Martin Morgan mtmor...@fredhutch.org wrote: On 11/12/2014 05:36 AM, Zheng Da wrote: Hello, I wrote a system to perform data analysis in C++. Now I am integrating it to R. I need to allocate memory for my own C++ data structures, which can't be represented

[Rd] Error promise already under evaluation ... with function(x, dim=dim(x))

2014-11-14 Thread Henrik Bengtsson
I've meant to ask the following for several years now. I understand why: foo - function(x, dim=dim) { dim } foo(1) Error in foo(1) : promise already under evaluation: recursive default argument reference or earlier problems? gives an error, but why wouldn't/couldn't the following work?

[Rd] Code tools for identifying which package A functions package B use?

2014-11-14 Thread Henrik Bengtsson
Hi, I'd like to list all package PkgA functions that another package PkgB use via Depends or Imports (ignoring Suggests for simplicity). As long as PkgB uses importFrom(PkgA, ...) it's just a matter of parsing the NAMESPACE file or inspecting asNamespace(PkgB)$.__NAMESPACE__.$imports. However,

Re: [Rd] Code tools for identifying which package A functions package B use?

2014-11-14 Thread Henrik Bengtsson
wrote: The best thing I have found is codetoolsBioC in the Bioconductor subversion repository. Best, Kasper On Fri, Nov 14, 2014 at 9:57 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I'd like to list all package PkgA functions that another package PkgB use via Depends or Imports

Re: [Rd] Cursor not behaving properly

2014-11-19 Thread Henrik Bengtsson
FYI, it might be useful to check if the bug also appears on R-devel as well as on earlier versions of R. That might narrow down whether it was introduced in a particular R version or not, which in turn would be useful to whoever might try to tackle this problem. It might not even be an R problem

Re: [Rd] R string comparisons may vary with platform (plain text)

2014-11-22 Thread Henrik Bengtsson
On Sat, Nov 22, 2014 at 12:42 PM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 22/11/2014, 2:59 PM, Stuart Ambler wrote: A colleague¹s R program behaved differently when I ran it, and we thought we traced it probably to different results from string comparisons as below, with different R

[Rd] Rprof(..., memory.profiling=TRUE) to profile C memory allocation?

2014-11-22 Thread Henrik Bengtsson
Could someone please confirm/refute that Rprof(..., memory.profiling=TRUE) can also be used to profile memory allocation done in a C function (src/*.c) that uses, e.g. allocVector(INTSXP, n) but also allocations such as R_alloc(n, sizeof(int)) ? Modulo how R was built, does the answer

Re: [Rd] Error promise already under evaluation ... with function(x, dim=dim(x))

2014-11-23 Thread Henrik Bengtsson
On Sat, Nov 15, 2014 at 1:47 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 14/11/2014, 9:06 PM, Henrik Bengtsson wrote: I've meant to ask the following for several years now. I understand why: foo - function(x, dim=dim) { dim } foo(1) Error in foo(1) : promise already

Re: [Rd] Error promise already under evaluation ... with function(x, dim=dim(x))

2014-11-23 Thread Henrik Bengtsson
On Sun, Nov 23, 2014 at 4:07 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: On Sat, Nov 15, 2014 at 1:47 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 14/11/2014, 9:06 PM, Henrik Bengtsson wrote: I've meant to ask the following for several years now. I understand why: foo

[Rd] R CMD check --as-cran and (a)spell checking

2014-12-05 Thread Henrik Bengtsson
* this is package 'matrixStats' version '0.12.0' * checking CRAN incoming feasibility ... NOTE Maintainer: 'Henrik Bengtsson henr...@braju.com' Possibly mis-spelled words in DESCRIPTION: rowMedians (18:74) rowRanks (18:92) rowSds (18:111) * checking package namespace information ... OK ... Thanks

Re: [Rd] R on the Cydia Store

2014-12-09 Thread Henrik Bengtsson
On Dec 9, 2014 6:38 AM, Apps Embedded apps.embed...@gmail.com wrote: Hi, We have published an Android app called R Console on the Play Store since Décember 2013. https://play.google.com/store/apps/details?id=com.appsopensource.R

[Rd] SUGGESTION: Force install.packages() to use ASCII encoding when parse():ing code?

2014-12-11 Thread Henrik Bengtsson
SUGGESTION: Would it make sense if install.packages() and friends always use an ascii(*) encoding when parse():ing R package source code files? I believe this should be safe, because R code files should be in ASCII [http://en.wikipedia.org/wiki/ASCII] and only in source-code comments you may use

Re: [Rd] SUGGESTION: Force install.packages() to use ASCII encoding when parse():ing code?

2014-12-11 Thread Henrik Bengtsson
On Thu, Dec 11, 2014 at 10:47 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 11/12/2014 12:59 PM, Henrik Bengtsson wrote: SUGGESTION: Would it make sense if install.packages() and friends always use an ascii(*) encoding when parse():ing R package source code files? I think

Re: [Rd] Benchmark code, but avoid printing

2015-01-02 Thread Henrik Bengtsson
On Fri, Jan 2, 2015 at 9:02 AM, Gábor Csárdi csardi.ga...@gmail.com wrote: Dear all, I am trying to benchmark code that occasionally prints on the screen and I want to suppress the printing. Is there an idiom for this? If I do sink(tempfile) microbenchmark(...) sink() then I'll be

[Rd] WISH: eval() to preserve the visibility (now value is always visible)

2015-02-07 Thread Henrik Bengtsson
Would it be possible to have the value of eval() preserve the visibility of the value of the expression? PROBLEM: # Invisible x - 1 # Visible eval(x - 2) [1] 2 TROUBLESHOOTING: withVisible(x - 1) $value [1] 1 $visible [1] FALSE withVisible(eval(x - 2)) $value [1] 2 $visible [1] TRUE

Re: [Rd] default min-v/nsize parameters

2015-01-20 Thread Henrik Bengtsson
Thanks for this. Anyone know how I can find what those initial settings are from within R? Do I need to parse/look at both environment variables R_NSIZE and R_VSIZE and then commandArgs()? /Henrik On Tue, Jan 20, 2015 at 1:42 AM, Martin Maechler maech...@stat.math.ethz.ch wrote: Peter Haverty

Re: [Rd] :: and ::: as .Primitives?

2015-01-22 Thread Henrik Bengtsson
On Thu, Jan 22, 2015 at 11:44 AM, luke-tier...@uiowa.edu wrote: I'm not convinced that how to make :: faster is the right question. If you are finding foo::bar being called often enough to matter to your overall performance then to me the question is: why are you calling foo::bar more than

Re: [Rd] Programming Tools CTV

2015-01-22 Thread Henrik Bengtsson
On Thu, Jan 22, 2015 at 7:20 AM, Max Kuhn mxk...@gmail.com wrote: I've had a lot of requests for additions to the reproducible research task view that fall into a grey area (to me at least). For example, roxygen2 is a tool that broadly enable reproducibility but I see it more as a tool for

Re: [Rd] problem with update.packages() in R-Devel (3.2.0) on Windows

2015-01-27 Thread Henrik Bengtsson
It works again using: % R --version R Under development (unstable) (2015-01-26 r67627) -- Unsuffered Consequences Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) /Henrik On Mon, Jan 26, 2015 at 9:54 AM, John Fox j...@mcmaster.ca wrote:

[Rd] Output to raw console rather than stdout/stderr?

2015-02-01 Thread Henrik Bengtsson
In R, there's readline(), which is great because you can prompt the user, e.g. ans - readline(Would you like to install Pandoc? [y/N]: ) without having to worry the message is intercepted by capture.output(), sink() or similar (which is used by dynamic report generators among other things).

Re: [Rd] Output to raw console rather than stdout/stderr?

2015-02-01 Thread Henrik Bengtsson
, that's the spirit of my cmsg() below. Hope this makes more sense now Henrik On Sun, Feb 1, 2015 at 11:13 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: In R, there's readline(), which is great because you can prompt the user, e.g. ans - readline(Would you like to install Pandoc? [y

Re: [Rd] Inspect a delayed assigned whose value throws an error?

2015-01-26 Thread Henrik Bengtsson
. Thanks, Henrik Hadley On Mon, Jan 26, 2015 at 12:53 PM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: Hi, I got an interesting programming challenge: How do you inspect an object which is assigned via delayedAssign() and that throws an error as soon as it is touched (=the value

[Rd] Shouldn't grDevices::quartz() give an error instead of a warning when not available?

2015-01-10 Thread Henrik Bengtsson
Compare: quartz(); cat(Should this have generated an error instead?\n) Warning message: In quartz() : Quartz device is not available on this platform Should this have generated an error instead? to: x11() Error in .External2(C_X11, d$display, d$width, d$height, d$pointsize, : unable to

Re: [Rd] WISH: eval() to preserve the visibility (now value is always visible)

2015-02-10 Thread Henrik Bengtsson
On Sun, Feb 8, 2015 at 8:44 PM, Suharto Anggono Suharto Anggono via R-devel r-devel@r-project.org wrote: Sorry to intervene. No, I'm very happy you intervened. You're comment is 100% valid/correct making my wish moot. Your explanation is very clear and nails it; one should use

Re: [Rd] Performance issue in stats:::weighted.mean.default method

2015-03-05 Thread Henrik Bengtsson
See weightedMean() in the matrixStats package. It's optimized for data type, speed and memory and implemented in native code so it can avoid some of these intermediate copies. It's a few times faster than weighted.mean[.default](); library(matrixStats) library(microbenchmark) n - 5000 x -

Re: [Rd] static pdf vignette

2015-02-27 Thread Henrik Bengtsson
On Fri, Feb 27, 2015 at 4:05 AM, Kirill Müller kirill.muel...@ivt.baug.ethz.ch wrote: Perhaps the R.rsp package by Henrik Bengtsson [1,2] is an option. Cheers Kirill [1] http://cran.r-project.org/web/packages/R.rsp/index.html [2] https://github.com/HenrikBengtsson/R.rsp Yes, this use

Re: [Rd] Title case in DESCRIPTION for package where a word is a function namei

2015-04-25 Thread Henrik Bengtsson
On Apr 25, 2015 05:07, Prof J C Nash (U30A) nas...@uottawa.ca wrote: How about allowing underscore? (I believe WRE is silent on this, and I have not tried submitting a package with underscore in the title.) As I pointed out in my OP, _optim()_ works. And we have the advantage that we can

[Rd] Shouldn't vector indexing with negative out-of-range index give an error?

2015-05-04 Thread Henrik Bengtsson
In Section 'Indexing by vectors' of 'R Language Definition' (http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-by-vectors) it says: Integer. All elements of i must have the same sign. If they are positive, the elements of x with those index numbers are selected. If i contains

[Rd] capabilities(X11): Force refresh from within R? (... and minor documentation issue)

2015-05-06 Thread Henrik Bengtsson
Is there a way to refresh capabilities(X11) without restarting R such that it reflects the enabling/disabling of X11? BACKGROUND: If I launch R with X11 server disabled (e.g. ssh -X / ssh -Y to remote Linux but forgot to enable Xming on local Windows), then I get: capabilities(X11) X11

Re: [Rd] Shouldn't vector indexing with negative out-of-range index give an error?

2015-05-06 Thread Henrik Bengtsson
...@lynne.stat.math.ethz.ch wrote: Henrik Bengtsson henrik.bengts...@ucsf.edu on Mon, 4 May 2015 12:20:44 -0700 writes: In Section 'Indexing by vectors' of 'R Language Definition' (http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-by-vectors

[Rd] PATCH: library(..., quietly=TRUE) still outputs Loading required package: ... (forgot to pass down 'quietly')

2015-05-09 Thread Henrik Bengtsson
Calling library(..., quietly=TRUE) may still output: Loading required package: other pkg in some cases, e.g. library(R.utils, quietly=TRUE) Loading required package: R.methodsS3 [...] I traced this to base:::.getRequiredPackages2(), which forgets to pass 'quietly' to an internal library()

Re: [Rd] R Language Definition: Subsetting matrices with negative indices is *not* an error

2015-05-09 Thread Henrik Bengtsson
On Sat, May 9, 2015 at 12:55 AM, peter dalgaard pda...@gmail.com wrote: On 09 May 2015, at 02:53 , Henrik Bengtsson henrik.bengts...@ucsf.edu wrote: Hi, I spotted what looks like another(*) mistake in 'R Language Definition' on how subsetting should work. In Section 'Indexing matrices

[Rd] R Language Definition: Subsetting matrices with negative indices is *not* an error

2015-05-08 Thread Henrik Bengtsson
Hi, I spotted what looks like another(*) mistake in 'R Language Definition' on how subsetting should work. In Section 'Indexing matrices and arrays' [http://cran.r-project.org/doc/manuals/r-release/R-lang.html#Indexing-matrices-and-arrays] one can read Negative indices are not allowed in

[Rd] WISH: A more informative abor message than aborting ...

2015-05-12 Thread Henrik Bengtsson
When R aborts (core dumps), it outputs: aborting ... This message is rather generic and can be hard to track back to R itself, i.e. it is not always clear whether it is R itself that aborted or some other piece of code that caused the abort/core dump and outputted that message. May I suggest

Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-16 Thread Henrik Bengtsson
On Fri, May 15, 2015 at 8:01 AM, Simon Urbanek simon.urba...@r-project.org wrote: On May 13, 2015, at 2:28 PM, Henrik Bengtsson henrik.bengts...@ucsf.edu wrote: While at it: 'Makevars' is an R invention (i.e. documentation of it is only available through the R docs), correct? /Henrik

Re: [Rd] Alternative for wildcard gnu extension in Makevars

2015-05-13 Thread Henrik Bengtsson
While at it: 'Makevars' is an R invention (i.e. documentation of it is only available through the R docs), correct? /Henrik On Wed, May 13, 2015 at 10:10 AM, Kevin Ushey kevinus...@gmail.com wrote: One other solution that's only a little crazy: you could have a R function within your package

Re: [Rd] Creating a vignette which depends on a non-distributable file

2015-05-14 Thread Henrik Bengtsson
On May 14, 2015 15:04, January Weiner january.wei...@gmail.com wrote: Dear all, I am writing a vignette that requires a file which I am not allowed to distribute, but which the user can easily download manually. Moreover, it is not possible to download this file automatically from R:

[Rd] install.packages() / update.packages() sometimes outputs to stdout and sometimes to stderr [and menu() readline()]

2015-05-17 Thread Henrik Bengtsson
I've noticed that install.packages() [https://svn.r-project.org/R/trunk/src/library/utils/R/packages.R] and update.packages() [https://svn.r-project.org/R/trunk/src/library/utils/R/packages2.R] sometimes output to stdout and sometimes to stderr. It looks like stderr is used (e.g. via cat()) when

Re: [Rd] The function cummax() seems to have a bug.

2015-05-17 Thread Henrik Bengtsson
Below is some further troubleshooting on this: From code inspection this bug happens for only: * for integer values * when the first element is NA_integer_ and the second is not. Examples: # Numeric/doubles works as expected cummax(c(NA_real_, 0, 1, 2, 3)) [1] NA NA NA NA NA # It does not

Re: [Rd] Why is the diag function so slow (for extraction)?

2015-05-13 Thread Henrik Bengtsson
overflows. -y - c(x)[1 + 0L:(m - 1L) * (dim(x)[1L] + 1)] -nms - dimnames(x) +if (is.object(x)) x - c(x) /Henrik On Tue, May 12, 2015 at 8:24 PM, Henrik Bengtsson henrik.bengts...@ucsf.edu wrote: Along Luke's lines, would(n't) it be enough to look for existence

Re: [Rd] How best to get around shadowing of executables by system()'s prepending of directories to Windows' PATH?

2015-05-18 Thread Henrik Bengtsson
You probably already know, but you can at least work around it as: Sys.which2 - function(cmd) { stopifnot(length(cmd) == 1) if (.Platform$OS.type == windows) { suppressWarnings({ pathname - shell(sprintf(where %s 2 NUL, cmd), intern=TRUE)[1] }) if (!is.na(pathname))

Re: [Rd] Why is the diag function so slow (for extraction)?

2015-05-12 Thread Henrik Bengtsson
Along Luke's lines, would(n't) it be enough to look for existence of attribute 'class' to decide whether to dispatch or not, i.e. if c() is needed or not? Even without .subset(), there is a remarkable improvement. I think it's worth condition the code on dispatch or not. For example:

Re: [Rd] Package compilation woes on submission.

2015-04-07 Thread Henrik Bengtsson
I've been there too. The clang compiler does useful validation and troubleshooting of your code in addition to what you get with gcc. I recommend installing/trying it as a complement to your default setup. It has a -c option for Only run preprocess, compile, and assemble steps allowing you do

Re: [Rd] Listing all spawned jobs/processed after parallel::mcparallel()?

2015-06-23 Thread Henrik Bengtsson
On Sun, Jun 21, 2015 at 9:59 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 20/06/2015 22:21, Henrik Bengtsson wrote: QUESTION: Is it possible to query number of active jobs running after launching them with parallel::mcparallel()? For example, if I launch 3 jobs using: library

[Rd] Listing all spawned jobs/processed after parallel::mcparallel()?

2015-06-20 Thread Henrik Bengtsson
QUESTION: Is it possible to query number of active jobs running after launching them with parallel::mcparallel()? For example, if I launch 3 jobs using: library(parallel) f - lapply(1:3, FUN=mcparallel) then I can inspect them as: str(f) List of 3 $ :List of 2 ..$ pid: int 142225 ..$

[Rd] Code demos via HTML help gives an error

2015-06-16 Thread Henrik Bengtsson
PROBLEM: I'm getting error: Error in order(matches$Position) : argument 1 is not a vector Whenever I try to access a package's Code demos page via the link on the package HTML index page. SOME TROUBLESHOOTING: Looking at for instance the 'stats' package. The Code demos URL takes the form

Re: [Rd] RFC: Declaring foo.bar as nonS3method() ?!

2015-06-12 Thread Henrik Bengtsson
Analogously to how S4 methods are declared in the code, cf. methods::setMethod(), I'd find it more natural to also declare S3 methods in the code and note in the NAMESPACE. For example: # S3 method summary() for class 'aov': summary.aov - function(x, ...) { # something } S3class(summary.aov)

Re: [Rd] Code demos via HTML help gives an error

2015-06-17 Thread Henrik Bengtsson
Went ahead and did it directly, cf. PR #16432 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16432). /H On Wed, Jun 17, 2015 at 4:02 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 16/06/2015 4:20 PM, Henrik Bengtsson wrote: PROBLEM: I'm getting error: Error in order(matches

Re: [Rd] Add-on argument in sample()

2015-06-15 Thread Henrik Bengtsson
You're not the first one, e.g. https://stat.ethz.ch/pipermail/r-devel/2010-March/057029.html https://stat.ethz.ch/pipermail/r-devel/2010-November/058981.html (I was bitten by this in a resampling scheme where the set sampled from was data driven). Here's a simple solution - taken from

Re: [Rd] sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...

2015-05-31 Thread Henrik Bengtsson
LDOUBLE double #endif So now I should rephrase my question: Is there away to avoid this penalty when using 'long double'? Is this something the compiler can be clever about, or is the only solution to not use 'long double'? /Henrik On Sun, May 31, 2015 at 5:02 PM, Henrik Bengtsson henrik.bengts

[Rd] sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...

2015-05-31 Thread Henrik Bengtsson
I'm observing that base::sum(x, na.rm=FALSE) for typeof(x) == double is much more time consuming when there are missing values versus when there are not. I'm observing this on both Window and Linux, but it's quite surprising to me. Currently, my main suspect is settings in on how R was built.

Re: [Rd] MetaCran website v1.0.0-alpha

2015-05-24 Thread Henrik Bengtsson
On May 24, 2015 2:44 AM, Rainer M Krug rai...@krugs.de wrote: Gábor Csárdi csardi.ga...@gmail.com writes: Dear All, [ I was wondering if this should have gone to the new mailing list. Maybe. ] As some of you maybe know from my earlier posts, I am building a simple search engine for

Re: [Rd] MetaCran website v1.0.0-alpha

2015-05-26 Thread Henrik Bengtsson
On Tue, May 26, 2015 at 12:45 AM, Gábor Csárdi csardi.ga...@gmail.com wrote: On Mon, May 25, 2015 at 8:28 PM, Simon Urbanek simon.urba...@r-project.org wrote: One issue I have with this is that it doesn't point to the original GitHub repositories of the packages, so you end up with additional

Re: [Rd] download.file() on ftp URL fails in windows with default download method

2015-08-08 Thread Henrik Bengtsson
Works for me on Windows 7. Also when I explicitly set 'method' to internal, libcurl, curl, wininet and 'wget. sessionInfo() R version 3.2.2 beta (2015-08-04 r68843) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1]

Re: [Rd] unset() function?

2015-08-22 Thread Henrik Bengtsson
Hi, I was playing around with this idea earlier this year. This would allow you to remove a variable with NAMED2 while still passing it's value, e.g. x1 - log(r(x1)) where the returned value/variable has NAMED=1. At first I was quite excited about the results, but it turned out that it

[Rd] capture.output() duplicates last line unless newline (R-devel bug)

2015-08-14 Thread Henrik Bengtsson
In R-devel (2015-08-12 r69024), capture.output() incorrectly duplicates the last line unless it ends with a newline. I don't see this in R 3.2.2 RC (2015-08-13 r69049). It seems to have started fairily recently; I spotted this yesterday after starting to get errors in my R.utils check that use

Re: [Rd] Why not pthreads on Windows in 'parallel' package?

2015-08-14 Thread Henrik Bengtsson
On Fri, Aug 14, 2015 at 5:00 PM, Henrik Bengtsson henrik.bengts...@ucsf.edu wrote: On Windows there are a few 'pthreads' implementation, e.g. pthreads-w32 and winpthreads [ https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Using-pthreads ]. We're thinking of giving them a try

Re: [Rd] Best way to implement optional functions?

2015-10-25 Thread Henrik Bengtsson
On Thu, Oct 22, 2015 at 3:48 PM, Paul Gilbert wrote: > > > On 10/22/2015 03:55 PM, Duncan Murdoch wrote: >> >> I'm planning on adding some new WebGL functionality to the rgl package, >> but it will pull in a very large number of dependencies. Since many >> people won't need

Re: [Rd] PDFs and SVGs containing rasterGrobs don't display correctly in some other software

2015-11-05 Thread Henrik Bengtsson
On Nov 5, 2015 03:45, "Richard Cotton" wrote: > > I've just been trying to post-process some R-created heatmaps using > Inkscape, but I can't get them to display correctly in that software. > > To reproduce: > > library(grid) > r <- as.raster(matrix(runif(25), 5, 5)) >

Re: [Rd] A where() functions that does what exists() does but return the environment when object lives?

2015-10-13 Thread Henrik Bengtsson
Thanks Uwe and thanks Hadley. I ended up implementing: ## Emulates R internal findVar1mode() function ## https://svn.r-project.org/R/trunk/src/main/envir.c where <- function(x, where=-1, envir=if (missing(frame)) { if (where < 0) parent.frame(-where) else as.environment(where) } else

[Rd] A where() functions that does what exists() does but return the environment when object lives?

2015-10-09 Thread Henrik Bengtsson
Hi, exists("foo", inherits=TRUE) check whether an object named "foo" exists, and get("foo", inherits=TRUE) retrieves it. I'm looking for a similar function to exists() that returns the environment where the object "foo" exists, iff at all. If not found, NULL is returned. Does that exist?

Re: [Rd] A where() functions that does what exists() does but return the environment when object lives?

2015-10-13 Thread Henrik Bengtsson
order as exists/get(..., envir, inherits=TRUE) does it. getAnywhere() will search everything in any order. It's a start though. Cheers, Henrik > > Best, > Uwe > > > On 10.10.2015 01:18, Henrik Bengtsson wrote: >> >> Hi, >> >> exists("foo", inh

[Rd] Rscript --args -e / R --vanilla --slave --args -e opens an interactive R session

2015-09-22 Thread Henrik Bengtsson
When using Rscript -e , (mistakenly) putting --args in front of -e causes an interactive R session to start that does not quit automatically and that does not display a prompt. For example, {hb}: Rscript --vanilla -e "0" [1] 0 {hb}: Rscript --vanilla -e "0" --args [1] 0 {hb}: Rscript --vanilla

Re: [Rd] Long vectors: Missing values and R_xlen_t?

2015-09-21 Thread Henrik Bengtsson
On Mon, Sep 21, 2015 at 11:20 AM, Simon Urbanek <simon.urba...@r-project.org> wrote: > > On Sep 20, 2015, at 3:06 PM, Henrik Bengtsson <henrik.bengts...@ucsf.edu> > wrote: > >> Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER >>

[Rd] Long vectors: Missing values and R_xlen_t?

2015-09-21 Thread Henrik Bengtsson
Is there a missing value constant defined for R_xlen_t, cf. NA_INTEGER (== R_NaInt == INT_MIN) for int(eger)? If not, is it correct to assume that missing values should be taken care/tested for before coercing from int or double? Thank you, Henrik __

Re: [Rd] RProfmem output format

2016-06-04 Thread Henrik Bengtsson
I'm picking up this 5-year old thread. 1. About the four memory allocations without a stacktrace I think the four memory allocations without a stacktrace reported by Rprofmem(): > Rprofmem(); x <- raw(2000); Rprofmem("") > cat(readLines("Rprofmem.out", n=5, warn=FALSE), sep="\n") 192 :360 :360

Re: [Rd] Multiple cores are used in simple for loop

2016-01-15 Thread Henrik Bengtsson
On Fri, Jan 15, 2016 at 10:15 AM, Daniel Kaschek wrote: > Dear Martyn, > > > On Fr, Jan 15, 2016 at 4:01 , Martyn Plummer wrote: >> >> >> Alternatively, you may be able to control the maximum number of threads >> by setting and exporting

Re: [Rd] Best way for rgl's .onLoad to fail?

2016-02-01 Thread Henrik Bengtsson
If I recall it correctly, at least on Linux, rgl only needs X11 when rgl.useNULL(FALSE). Is that correct? If so, I would say dependency on X11 is optional and therefore you should be able to load the package even without X11. Or is it that it still requires X11 libs but not an X11 server? My

[Rd] Milestone: 8000 packages on CRAN

2016-02-29 Thread Henrik Bengtsson
Another 1000 packages were added to CRAN, which took less than 7 months. Today (February 29, 2017), the Comprehensive R Archive Network (CRAN) [1] reports: “Currently, the CRAN package repository features 8002 available packages.” The rate with which new packages are added to CRAN is increasing.

[Rd] formals(x)<- drops attributes including class

2016-03-13 Thread Henrik Bengtsson
Just checking in to see whether it is intended or not that assigning new formals to a function/closure causes any attributes to be dropped: EXAMPLE: > fcn <- structure(function() {}, foo="foo", class=c("foo")) > str(fcn) function () - attr(*, "srcref")=Class 'srcref' atomic [1:8] 1 18 1 30 18

Re: [Rd] Under Windows, Rgui and Rterm crash if one tries to close the graphic device while identify or locator are running

2016-04-05 Thread Henrik Bengtsson
If of any help, I can reproduce this (on Windows 7) back to at least R 3.0.3 but it's not there in R 3.0.0. (I have *not* checked with R 3.0.1 and 3.0.2 which I don't have installed). /Henrik On Tue, Apr 5, 2016 at 8:23 AM, Duncan Murdoch wrote: > Thanks, I'll track

Re: [Rd] R not responding (must force quit) when saving graphic to PDF (bug?)

2016-04-11 Thread Henrik Bengtsson
I'm not an OS X user, but two things you might look into/help you troubleshoot: 1. Because you said it only happens when you try to overwrite an existing PDF, could it be that there is another process holding onto (=locking) the PDF file that you're trying to write to? For instance, are you

Re: [Rd] Milestone: 8000 packages on CRAN

2016-03-01 Thread Henrik Bengtsson
# 8: 2009-09-10 2000 maticce > ## 9: 2007-03-11 1000 cairoDevice > ## 10: 2005-02-21500 micEcon > ## 11: 2003-03-19250 polspline > > So including the archived packages in this report, 8K was actually > reached at the time of useR! 2015 :) > > B

Re: [Rd] Is it possible to increase MAX_NUM_DLLS in future R releases?

2016-05-10 Thread Henrik Bengtsson
Isn't the problem in Qin's example that unloadNamespace("scde") only unloads 'scde' but none of its package dependencies that were loaded when 'scde' was loaded. For example: $ R --vanilla > ns0 <- loadedNamespaces() > dlls0 <- getLoadedDLLs() > packageDescription("scde")[c("Depends",

[Rd] R devel: install.packages(..., type="both") not supported on Windows

2016-05-14 Thread Henrik Bengtsson
Is the following intentional or something that has been overlooked? [HB-X201]{hb}: R --vanilla R Under development (unstable) (2016-05-13 r70616) -- "Unsuffered Consequences" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) [...] ## Note

Re: [Rd] Is it possible to retrieve the last error? (not error *message*)

2016-05-05 Thread Henrik Bengtsson
r <- function() > { > tr <- .traceback() > if(length(tr) == 0) > { > return(NULL) > } > tryCatch(eval(parse(text = tr[[1]])), error = identity) > } > > Note that it uses .traceback() from R 3.3.0; you'll have to use > baseenv()$.Traceback with e

Re: [Rd] Is it possible to retrieve the last error? (not error *message*)

2016-05-04 Thread Henrik Bengtsson
On Wed, May 4, 2016 at 1:27 PM, David Winsemius <dwinsem...@comcast.net> wrote: > >> On May 4, 2016, at 12:41 PM, Henrik Bengtsson <henrik.bengts...@gmail.com> >> wrote: >> >> Hi, >> >> at the R prompt, is it possible to retrieve the la

[Rd] Is it possible to retrieve the last error? (not error *message*)

2016-05-04 Thread Henrik Bengtsson
Hi, at the R prompt, is it possible to retrieve the last error (as in condition object of class "error")? I'm not asking for geterrmessage(), which only returns the error message (as a character string). I'm basically looking for a .Last.error or .Last.condition, analogously to .Last.value for

[Rd] Closing a fifo() on Windows core dumps R (3.2.5, 3.3.0 RC and devel)

2016-05-01 Thread Henrik Bengtsson
The following core dumps R 3.2.5, R 3.3.0 RC and R devel on Windows. I have tried to use a minimal setup (for all versions tested), i.e. C:\> cd C:\ C:\> set PATH=C:\PROGRA~1\R\R-33~1.0RC\bin C:\> set R_DEFAULT_PACKAGES=base C:\> R --quiet --vanilla > close(fifo("foo.tmp", open="wb")) [core

Re: [Rd] Closing a fifo() on Windows core dumps R (3.2.5, 3.3.0 RC and devel)

2016-05-01 Thread Henrik Bengtsson
R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) /Henrik On Sun, May 1, 2016 at 7:08 PM, Henrik Bengtsson <henrik.bengts...@gmail.com> wrote: > The following core dumps R 3.2.5, R 3.3.0 RC and R devel on Windows. > I have tried to use a minimal setup (for

Re: [Rd] S3 dispatch for S4 subclasses only works if variable "extends" is accessible from global environment

2016-04-19 Thread Henrik Bengtsson
On Tue, Apr 19, 2016 at 9:21 AM, Hadley Wickham wrote: > > This might be too big a change - but is it worth reconsidering the > behaviour of Rscript? Maybe the simplest fix would be simply to always > load the methods package. (I think historically it didn't because >

[Rd] Is .packageName part of the official API?

2016-07-12 Thread Henrik Bengtsson
Hi, I've seen that some packages use .packageName internally to infer their own name. Is that officially supported? I could not find it documented anywhere. There's utils::packageName(), which internally looks for .packageName. However, if the latter is not found, it may return NULL whereas an

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-26 Thread Henrik Bengtsson
On a related note, the storage mode should try to match ans[[1]] (or unlist:ed and) when allocating 'ansmat' to avoid coercion and hence a full copy. Henrik On Jan 26, 2017 07:50, "William Dunlap via R-devel" wrote: It would be cool if the default for tapply's

Re: [Rd] cross-platform portable code in CRAN Repository Policy

2017-01-27 Thread Henrik Bengtsson
Second this. As the CRAN Policies suggests, there's also the very handy winbuilder service (https://win-builder.r-project.org/) you can use to check your package on Windows. This service has been a valuable workhorse for years. We should also mention the continuous integration (CI) services

[Rd] Subject: Milestone: 10000 packages on CRAN

2017-01-27 Thread Henrik Bengtsson
Continuing the tradition to post millennia milestones on CRAN: So, it happened. Today (January 27, 2017 PCT) CRAN reached 10,000 packages [1]. Needless to say, the rate with which new packages are added to CRAN keeps increasing and so does the number of contributors (maintainers). Somewhere out

Re: [Rd] RFC: tapply(*, ..., init.value = NA)

2017-01-27 Thread Henrik Bengtsson
uard against those functions that fail for 0 length arg. > > But I think the main reason for _not_ setting such a default is > back-compatibility. In my proposal, the new argument would not > be any change by default and so all current uses of tapply() > would remain unchanged. > >&

[Rd] parallel::mc*: Is it possible for a child process to know it is a fork?

2017-01-24 Thread Henrik Bengtsson
When using multicore-forking of the parallel package, is it possible for a child process to know that it is a fork? Something like: parallel::mclapply(1:10, FUN = function(i) { test_if_running_in_a_fork() }) I'm looking into ways to protect against further parallel processes (including

Re: [Rd] parallel::mc*: Is it possible for a child process to know it is a fork?

2017-01-25 Thread Henrik Bengtsson
On Tue, Jan 24, 2017 at 8:10 PM, Jeroen Ooms <jeroeno...@gmail.com> wrote: > On Tue, Jan 24, 2017 at 7:06 PM, Henrik Bengtsson > <henrik.bengts...@gmail.com> wrote: >> When using multicore-forking of the parallel package, is it possible >> for a child process to

[Rd] How to build R without support for translations?

2017-02-21 Thread Henrik Bengtsson
In Section 'Localization of messages' of R Installation and Administration (R 3.3.2), it says: "R can be built without support for translations, but it is enabled by default." How can this be done? Is this an option to 'configure', which I then failed to identify, or via some environment

Re: [Rd] How to build R without support for translations?

2017-02-21 Thread Henrik Bengtsson
On Tue, Feb 21, 2017 at 7:00 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 21 February 2017 at 18:45, Henrik Bengtsson wrote: > | In Section 'Localization of messages' of R Installation and > | Administration (R 3.3.2), it says: > | > |"R can be built wit

[Rd] Pressing either Ctrl-\ of Ctrl-4 core dumps R

2017-02-10 Thread Henrik Bengtsson
When running R from the terminal on Linux (Ubuntu 16.04), it core dumps whenever / wherever I press Ctrl-4 or Ctrl-\. You get thrown back to the terminal with "Quit (core dump)" being the only message. Grepping the R source code, it doesn't look like that message is generated by R itself. Over

Re: [Rd] Pressing either Ctrl-\ of Ctrl-4 core dumps R

2017-02-12 Thread Henrik Bengtsson
hether R should > ignore that signal, under some circumstances at least, is another > question. > > Best, > > luke > > > On Fri, 10 Feb 2017, Henrik Bengtsson wrote: > >> When running R from the terminal on Linux (Ubuntu 16.04), it core >> dumps whenever / w

Re: [Rd] Bug with zlib version checking for zlib >= 1.2.10, R version 3.3.2

2017-02-12 Thread Henrik Bengtsson
This has been fixed (https://cran.r-project.org/doc/manuals/r-devel/NEWS.html): CHANGES IN R 3.3.2 patched: INSTALLATION on a UNIX-ALIKE * The configure check for the zlib version is now robust to versions longer than 5 characters, including 1.2.10. in SVN r71889 (2017-01-03):

[Rd] Milestone: 9000 packages on CRAN

2016-08-22 Thread Henrik Bengtsson
An additional 1000 packages have been added to CRAN. This time, it took less than 6 months. Today (August 22, 2016), the Comprehensive R Archive Network (CRAN) [1] reports: “Currently, the CRAN package repository features 9004 available packages.” The rate with which new packages are added to

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