Re: [R-pkg-devel] How to update "SystemRequirements: C++11"?

2023-02-08 Thread Winston Chang
> > Now that I think about it some more, I think I can do the following: > > 1. In the DESCRIPTION file, remove "SystemRequirements: C++11". I believe > this field is used only for R CMD check, not for actually installing > packages. CRAN only runs R CMD check on r-oldrel, r-release, and r-devel,

Re: [R-pkg-devel] How to update "SystemRequirements: C++11"?

2023-02-06 Thread Winston Chang
On Mon, Feb 6, 2023 at 6:44 PM Duncan Murdoch wrote: > On 06/02/2023 3:46 p.m., Winston Chang wrote: > > I recently submitted a package to CRAN with "SystemRequirements: C++11". > > This raises the following NOTE on R-devel, and I was asked to fix and > >

[R-pkg-devel] How to update "SystemRequirements: C++11"?

2023-02-06 Thread Winston Chang
I recently submitted a package to CRAN with "SystemRequirements: C++11". This raises the following NOTE on R-devel, and I was asked to fix and resubmit: * checking C++ specification ... NOTE Specified C++11: please update to current default of C++17 If I understand correctly, I have two

[Rd] Rtools42 and included libraries

2021-12-17 Thread Winston Chang
Rtools42 includes the pre-compiled libraries needed to build most CRAN packages. From the blog ( https://developer.r-project.org/Blog/public/2021/12/07/upcoming-changes-in-r-4.2-on-windows/ ): > Most of the required package changes were due to downloading incompatible pre-compiled libraries at

Re: [Rd] Difference in NA behavior in R-devel running under valgrind

2021-04-29 Thread Winston Chang
Just to be clear, the RD binary that Jon used was NOT compiled with Valgrind level 2 instrumentation. In his example, however, he did run it with valgrind, as in: # RD -d valgrind --quiet -e "sum(c(1, NA))" ... > sum(c(1, NA)) [1] NaN `RD` in that Docker image is a standard build of R-devel. The

Re: [Rd] Rebuilding and re-checking of downstream dependencies on CRAN Mac build machines

2020-03-26 Thread Winston Chang
are available on CRAN: > https://cran.r-project.org/bin/macosx/tools/ (clang-7 and gfortran-6.1 for > 3.6.x) > > Cheers, > Simon > > > > On 27/03/2020, at 7:38 AM, Winston Chang wrote: > > > > I have two questions about the CRAN machines that build binar

[Rd] Rebuilding and re-checking of downstream dependencies on CRAN Mac build machines

2020-03-26 Thread Winston Chang
I have two questions about the CRAN machines that build binary packages for Mac. When a new version of a package is released, (A) Do the downstream dependencies get re-checked? (B) Do the downstream dependencies get re-built? I have heard (but do not know for sure) that the answer to (A) is

Re: [R-pkg-devel] Check Results ERROR on Windows R release

2019-05-17 Thread Winston Chang
It looks like hacSIM imports pegas, which imports adegenet, which imports dplyr. -Winston On Fri, May 17, 2019 at 11:04 AM Jarrett Phillips wrote: > > Hello, > > On submitting an update of my R package (HACSim), checks fail on > r-release-windows-ix86+x86_64 >

Re: [R-pkg-devel] Error appearing only with check_win_devel() - could be ggplot2 R version?

2019-03-30 Thread Winston Chang
On Sat, Mar 30, 2019 at 5:06 PM Gábor Csárdi wrote: > I think this is temporary and will go away once R-devel is built with > this: > https://github.com/wch/r-source/commit/9542c3215a8f8cfee4a313b6c2fd03320e38e1de > > Before that commit (76285), I was getting a different error when I submitted a

[R-pkg-devel] Version of make on CRAN Windows build machines

2019-03-26 Thread Winston Chang
On Windows I have a package that builds just fine with any recent version of Rtools. But on win-builder it fails because the version of GNU make on that machine does not support if-else syntax. Support for this syntax was added in GNU make 3.81, which was released in 2006. The version of Rtools on

Re: [Rd] [FORGED] recordPlot/replayPlot not working with saveRDS/readRDS

2018-04-03 Thread Winston Chang
On Mon, Apr 2, 2018 at 4:41 PM, Paul Murrell wrote: > Hi > > What you are doing "wrong" is loading a recordedplot into the same session > that it was created in. The saveRDS()/readRDS() works if you save in one R > session and then read in a different R session. The

[Rd] recordPlot/replayPlot not working with saveRDS/readRDS

2018-04-02 Thread Winston Chang
The documentation for recordPlot says the following: > As of R 3.3.0, it is possible (again) to replay a plot from another R session > using, for example, saveRDS and readRDS. However, I haven't been able to save and restore a plot displaylist and have it work within the same R session, using R

Re: [Rd] Objects not gc'ed due to caching (?) in R's S3 dispatch mechanism

2018-03-26 Thread Winston Chang
I'd like to emphasize that although Iñaki's example uses print(), it also happens with other S3 generics. Please note that each of the following examples might need to be run in a clean R session to work. === Here's an example that doesn't use S3 dispatch. The finalizer runs correctly.

Re: [Rd] CRAN indices out of whack (for at least macOS)

2018-02-03 Thread Winston Chang
Although it may not have been the cause of this particular index inconsistency, there are other causes of intermittent index inconsistencies. They could be avoided if there were a different directory structure on CRAN servers. One of the causes of inconsistencies is caching. With

Re: [Rd] R CMD check warning about compiler warning flags

2017-12-21 Thread Winston Chang
>> On recent builds of R-devel, R CMD check gives a WARNING when some >> compiler warning flags are detected, such as -Werror, because they are >> non-portable. This appears to have been added in this commit: >>https://github.com/wch/r-source/commit/2e80059 > > That is not the canonical R

[Rd] R CMD check warning about compiler warning flags

2017-12-20 Thread Winston Chang
On recent builds of R-devel, R CMD check gives a WARNING when some compiler warning flags are detected, such as -Werror, because they are non-portable. This appears to have been added in this commit: https://github.com/wch/r-source/commit/2e80059 I'm working on a package where these compiler

Re: [Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread Winston Chang
Thanks - I'll find another way to send messages to the main thread for printing. -Winston On Tue, Nov 21, 2017 at 12:42 PM, <luke-tier...@uiowa.edu> wrote: > On Tue, 21 Nov 2017, Winston Chang wrote: > >> Is it safe to call Rprintf and REprintf from a background thre

[Rd] Are Rprintf and REprintf thread-safe?

2017-11-21 Thread Winston Chang
Is it safe to call Rprintf and REprintf from a background thread? I'm working on a package that makes calls to fprintf(stderr, ...) on a background thread when errors happen, but when I run R CMD check, it says: Compiled code should not call entry points which might terminate R nor write to

Re: [Rd] system/system2 and open file descriptors

2017-04-19 Thread Winston Chang
inside of RStudio on a Mac, if there are any extant child processes started by system(), they keep some files open, and this causes RStudio to hang. (There's a fix in progress for RStudio for this particular issue.) -Winston On Tue, Apr 18, 2017 at 3:20 PM, Winston Chang <winstoncha...@gmail.com>

[Rd] system/system2 and open file descriptors

2017-04-18 Thread Winston Chang
It seems that the system() and system2() functions don't close file descriptors between the fork() and exec() (on Unix platforms, of course). This means that the child processes inherit open files and socket connections. Running this (from a terminal) will result in the child process writing to a

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-06 Thread Winston Chang
tithreaded environments. But finalizers violate this mental model. Because they can unexpectedly interrupt your code and execute other code, you can end up with some of the same problems that you would face in a multithreaded environment. Thanks to everyone who spent time helping to diagnose the p

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
> > Also my suspicion, can you try without having JIT enabled? > The results for different JIT levels. I ran compiler::enableJIT() before sourcing the test file: 3: error 2: error 1: OK 0: OK -Winston [[alternative HTML version deleted]] __

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
> > Apologies in advance if this is just stating the obvious, but let me try > and put some general ideas on the table. These are great ideas, thanks. > - is anything non-deterministic involved? (Doesn't sound so, but...) > There was an environment where items were added, and the names of

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
t$release() at testthat/test-scheduling.R:13 3: private$callback() -Winston On Wed, Apr 5, 2017 at 4:32 PM, Dirk Eddelbuettel <e...@debian.org> wrote: > > On 5 April 2017 at 15:46, Winston Chang wrote: > | On Wed, Apr 5, 2017 at 2:24 PM, Robert McGehee < > rmcge...@walleyetradi

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
compiled with anything fancy. Though nowadays, the out-of-the-box R BLAS > seems much faster than it used to be, so I don't even bother fiddling with > a custom BLAS. > > --Robert > > > -Original Message- > From: R-devel [mailto:r-devel-boun...@r-project.org] On Behal

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
On Wed, Apr 5, 2017 at 2:24 PM, Robert McGehee wrote: > Winston, > I had a similar experience to you tracking down an insanely difficult bug > in my R code that "disappeared" whenever slight changes were made to the > script (e.g. like adding cat() statements). In my

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-05 Thread Winston Chang
) On Wed, Apr 5, 2017 at 2:59 AM, Martin Maechler <maech...@stat.math.ethz.ch> wrote: > > >>>>> Winston Chang <winstoncha...@gmail.com> > >>>>> on Tue, 4 Apr 2017 15:29:40 -0500 writes: > > > I've done some more investigation in

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-04 Thread Winston Chang
> > >> I've done some more investigation into the problem, and it is very difficult to pin down. What it looks like is happening is roughly like this: - `p` is an environment and `p$e` is also an environment. - There is a loop. In each iteration, it looks for one item in `p$e`, saves it in a

Re: [Rd] Very hard to reproduce bug (?) in R-devel

2017-04-03 Thread Winston Chang
=== On Mon, Apr 3, 2017 at 10:34 AM, Winston Chang <winstoncha...@gmail.com> wrote: > When running R CMD check on a package, we are encountering an error on > R-devel (as of 72457) on Linux. Unfortunately, it is very hard to > reproduce, and almost any change to the code make

[Rd] Very hard to reproduce bug (?) in R-devel

2017-04-03 Thread Winston Chang
When running R CMD check on a package, we are encountering an error on R-devel (as of 72457) on Linux. Unfortunately, it is very hard to reproduce, and almost any change to the code makes the error go away. I believe that this is due to a bug in R-devel, which has been present since at least

Re: [Rd] Frames in compiled functions

2016-11-11 Thread Winston Chang
It looks like the byte compiler is optimizing local() to an immediately-invoked function, instead of using eval() and substitute(). I don't know if that's exactly how it's implemented internally, but that's what it looks like here: compiler::enableJIT(0) fun <- function(x) {

[Rd] Problems with sub() due to inability to set encoding of ASCII strings

2016-09-29 Thread Winston Chang
I'm encountering a problem using sub() on strings in R 3.3.1 in Windows, using both RGui and RStudio. The problem happens when the starting string is ASCII, but the replacement string is UTF-8. If we create an ASCII string x1, its encoding is marked as "unknown", and doing a sub() on that string

[Rd] Time zone issues when compiling R

2016-09-15 Thread Winston Chang
I've been trying to build R 3.3.1 inside of a Nix environment on a Ubuntu 16.04 machine. It builds, but then it fails a regression test related to time zones, and I hope that someone could help me debug the problem. The failing test is in tests/reg-tests-rc.R

Re: [Rd] Extra copies of objects in environments when using $ operator?

2016-08-05 Thread Winston Chang
> > >> However, modifying a list contained in an environment *does* result in >> a copy -- tracemem prints out some info when we do the assignment: >> e <- new.env(parent = emptyenv()) >> e$x <- list(1) >> tracemem(e$x) >> # [1] "<0x1148c1708>" >> e$x[[1]] <- 2 >> # tracemem[0x1148c1708 ->

[Rd] Extra copies of objects in environments when using $ operator?

2016-08-05 Thread Winston Chang
My understanding is that R will not make copies of lists if there is only one reference to the object. However, I've encountered a case where R does make copies, even though (I think) there should be only one reference to the object. I hope that someone could shed some light on why this is

Re: [Rd] dowload.file(method="libcurl") and GET vs. HEAD requests

2016-06-22 Thread Winston Chang
09:35 PM, Winston Chang wrote: >> >> In R 3.2.4, if you ran download.file(method="libcurl"), it issues a >> HTTP GET request for the file. However, in R 3.3.0, it issues a HTTP >> HEAD request first, and then a GET requet. This can result in problems >> when the w

[Rd] dowload.file(method="libcurl") and GET vs. HEAD requests

2016-06-21 Thread Winston Chang
In R 3.2.4, if you ran download.file(method="libcurl"), it issues a HTTP GET request for the file. However, in R 3.3.0, it issues a HTTP HEAD request first, and then a GET requet. This can result in problems when the web server gives an error for a HEAD request, even if the file is available with

[Rd] Are downstream dependencies rebuilt when a package is updated on CRAN?

2015-07-02 Thread Winston Chang
I was wondering: are the downstream dependencies of a package rebuilt when a package is updated on CRAN? (I'm referring to the binary packages, of course.) The reason I ask is because there are cases where this can cause problems. Suppose that when pkgB is built, it calls pkgA::makeClosure(),

Re: [Rd] Plans to improve reference classes?

2015-06-23 Thread Winston Chang
I can provide a little background on why particular choices were made for R6. Generally speaking, speed is a primary consideration in making decisions about the design of R6. The basic structure of R6 classes is actually not so different from reference classes: an R6 object is an environment. But

Re: [Rd] R CMD check and missing imports from base packages

2015-04-29 Thread Winston Chang
On Tue, Apr 28, 2015 at 3:04 PM, Gábor Csárdi csardi.ga...@gmail.com wrote: E.g. if package 'ggplot2' uses 'stats::density()', and package 'igraph' also defines 'density()', and 'igraph' is on the search path, then 'ggplot2' will call 'igraph::density()' instead of 'stats::density()'. Just

Re: [Rd] Errors on Windows with grep(fixed=TRUE) on UTF-8 strings

2015-03-03 Thread Winston Chang
After a bit more investigation, I think I've found the cause of the bug, and I have a patch. This bug happens with grep(), when: * Running on Windows. * The search uses fixed=TRUE. * The search pattern is a single byte. * The current locale has a multibyte encoding. ===

[Rd] Errors on Windows with grep(fixed=TRUE) on UTF-8 strings

2015-03-02 Thread Winston Chang
On Windows, grep(fixed=TRUE) throws errors with some UTF-8 strings. Here's an example (must be run on Windows to reproduce the error): Sys.setlocale(LC_CTYPE, chinese) y - rawToChar(as.raw(c(0xe6, 0xb8, 0x97))) Encoding(y) - UTF-8 y # [1] 渗 grep(\n, y, fixed = TRUE) # Error in grep(\n, y, fixed =

Re: [Rd] Native characterset is wrong for unicode builds for Windows

2015-02-26 Thread Winston Chang
On Thu, Feb 26, 2015 at 2:09 PM, maill...@tlink.de maill...@tlink.de wrote: When I send some outlandish characters through enc2native (or format) in R 3.1.2 on Ubuntu trusty it works quite well: ®ØΔЊת [1] ®ØΔЊת enc2native(®ØΔЊת) [1] ®ØΔЊת Encoding(enc2native(®ØΔЊת)) [1] UTF-8 In

Re: [Rd] alternatives to do.call() when namespace is attached but not loaded?

2015-02-24 Thread Winston Chang
First, a clarification of terminology: a package can be loaded and attached, or loaded and not attached. It can't be attached and not loaded. To get the function from a package by name, you could do something like: getExportedValue(sna, snaFunName) where snaFunName is a string containing the

Re: [Rd] speedbump in library

2015-01-23 Thread Winston Chang
I think you can simplify a little by replacing this: pkg %in% loadedNamespaces() with this: .getNamespace(pkg) Whereas getNamespace(pkg) will load the package if it's not already loaded, calling .getNamespace(pkg) (note the leading dot) won't load the package. I can't speak to whether there

Re: [Rd] unloadNamespace

2015-01-09 Thread Winston Chang
It's probably because the first thing that unloadNamespace does is this: ns - asNamespace(ns, base.OK = FALSE) If you call asNamespace(tseries), it calls getNamespace(tseries), which has the side effect of loading that package (and its dependencies). One way to work around this is to check

Re: [Rd] we need an exists/get hybrid

2014-12-03 Thread Winston Chang
I've looked at related speed issues in the past, and have a couple related points to add. (I've put the info below at http://rpubs.com/wch/46428.) There’s a significant amount of overhead just from calling the R function get(). This is true even when you skip the pos argument and provide envir.

Re: [Rd] Non-webby links on Windows web page

2014-11-13 Thread Winston Chang
I agree that it would be nice to have mirrors configured the same. Several weeks ago, there was a change to the .htaccess file at the top level of the CRAN repository which brought down RStudio mirror, since the .htaccess file used an Apache module that wasn't installed on the RStudio mirror. A

[Rd] Unexpected behavior of identical() with language objects

2014-10-29 Thread Winston Chang
I ran into this and found the result very surprising: identical( quote({ a }), quote({ a }) ) # FALSE It seems related to curly braces. For example, parens work fine: identical( quote(( a )), quote(( a )) ) # TRUE Is this expected behavior? I can't seem to find anything in the help for

Re: [Rd] Unexpected behavior of identical() with language objects

2014-10-29 Thread Winston Chang
Ah, I was using identical() to compare two function bodies. It returns FALSE even when you remove srcrefs from the body: f1 - function(x) { if (TRUE) { x } } f2 - function(x) { if (TRUE) { x } } f1b - body(f1) f2b - body(f2) attributes(f1b) - NULL attributes(f2b) - NULL # The bodies look the

[Rd] Error when assigning value in environment which is a locked binding

2014-08-10 Thread Winston Chang
If an environment x contains a locked binding y which is also an environment, and then you try to assign a value to a binding inside of y, it can either succeed or fail, depending on how you refer to environment y. x - new.env() x$y - new.env() lockEnvironment(x, bindings = TRUE) # This

Re: [Rd] Error when assigning value in environment which is a locked binding

2014-08-10 Thread Winston Chang
somewhere in here. -Winston On Sun, Aug 10, 2014 at 8:46 PM, Winston Chang winstoncha...@gmail.com wrote: If an environment x contains a locked binding y which is also an environment, and then you try to assign a value to a binding inside of y, it can either succeed or fail, depending on how

Re: [Rd] Is it a good idea or even possible to redefine attach?

2014-08-05 Thread Winston Chang
On Tue, Aug 5, 2014 at 1:49 PM, Grant Rettke g...@wisdomandwonder.com wrote: Hi, Today I got curious about whether or not I /could/ remove `attach' from my system so: - Backed it up - Implemented a new one - Like this , | attach.old - attach | attach - function(...) {stop(NEVER USE

Re: [Rd] Is it a good idea or even possible to redefine attach?

2014-08-05 Thread Winston Chang
On Tue, Aug 5, 2014 at 4:37 PM, Grant Rettke g...@wisdomandwonder.com wrote: That is delightful. When I run it like this: • Start R • Nothing in .Rprofile • Paste in your code ╭ │ gcrenv - new.env() │ gcrenv$attach.old - attach │ gcrenv$attach - function(...){stop(NEVER USE ATTACH)}

Re: [Rd] modifying a persistent (reference) class

2014-08-01 Thread Winston Chang
R6 objects are basically just environments, so they're probably pretty simple to save and restore (I haven't tested it out, though). -Winston On Fri, Aug 1, 2014 at 4:00 PM, Gábor Csárdi csardi.ga...@gmail.com wrote: On Fri, Aug 1, 2014 at 4:47 PM, Ross Boylan r...@biostat.ucsf.edu wrote:

Re: [Rd] R CMD check warning with S3 method

2014-06-19 Thread Winston Chang
that cross-references to the dplyr package should be sufficient (Note that S4 generics get a free pass here and do not need to be documented when re-exported, but S3 generics do). Martyn On Tue, 2014-06-17 at 14:21 -0500, Winston Chang wrote: I'm getting an R CMD check warning with a package

Re: [Rd] R CMD check warning with S3 method

2014-06-19 Thread Winston Chang
On Thu, Jun 19, 2014 at 3:15 PM, Martyn Plummer plumm...@iarc.fr wrote: Export filter in the NAMESPACE file *without copying it* in the R source code. Ah, it works! Thank you! [[alternative HTML version deleted]] __ R-devel@r-project.org

[Rd] R CMD check warning with S3 method

2014-06-17 Thread Winston Chang
I'm getting an R CMD check warning with a package (call it package A) that defines an S3 method but not the generic. The generic is defined in another package (package B). Package A imports the S3 generic from B. And there's one additional detail: the generic overrides a function in the stats

Re: [Rd] R CMD check warning with S3 method

2014-06-17 Thread Winston Chang
I forgot to add this - here's the warning: * checking S3 generic/method consistency ... WARNING Warning: declared S3 method 'filter.test' not found See section 'Generic functions and methods' of the 'Writing R Extensions' manual. On Tue, Jun 17, 2014 at 2:21 PM, Winston Chang winstoncha

Re: [Rd] Style question

2014-05-30 Thread Winston Chang
Using `::` does add some overhead - on the order of 5-10 microseconds on my computer. Still, it would take 100,000 calls to add 0.5-1 second of delay. microbenchmark( base::identity(1), identity(1), unit = us ) # Unit: microseconds # expr min lq median uqmax

Re: [Rd] access environment in which an error occurred

2014-05-08 Thread Winston Chang
I think this should do the trick: test - function() { b - 3 stop('error here') } df3 - function() { saveRDS(sys.frame(1), file = dump.rds) } options(error = df3) test() # Error in test() : error here # Read in the file and examine the environment frame - readRDS(dump.rds) ls(frame) #

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-12 Thread Winston Chang
On Tue, Feb 11, 2014 at 3:27 PM, Simon Urbanek simon.urba...@r-project.org wrote: I suspect the problem could be classified as bug in methods which doesn't behave correctly if not attached. I didn't look into details, but there used to be a technical problem in R C API where you could not

Re: [Rd] $new cannot be accessed when running from Rscript and methods package is not loaded

2014-02-11 Thread Winston Chang
To state the issue that Kirill raised in a different way... A package with S4 or reference classes and Depends:methods can throw an error when you do something as simple as this: Rscript -e mypackage::foo() But this will work: Rscript -e library(mypackage); foo() This is because when

Re: [Rd] Behavior of --install-tests and testInstalledPackage

2014-01-27 Thread Winston Chang
On Wed, Jan 22, 2014 at 10:55 AM, Brian Lee Yung Rowe r...@muxspace.comwrote: Hello, I'm writing a script that automates the testing of reverse dependencies of a package. I found the function testInstalledPackage in the tools package, which seems to do what I want. However, when I use it for

[Rd] Strange warnings when unloading packages with S4 classes

2013-12-19 Thread Winston Chang
I've been seeing warnings when unloading packages. They can be seen with the shiny and sp packages, among others (this is on R 3.0.2). For example: library(sp) unloadNamespace('sp') Warning messages: 1: In FUN(X[[2L]], ...) : Created a package name, ‘2013-12-19 12:14:24’, when none found 2: In

Re: [Rd] Strange warnings when unloading packages with S4 classes

2013-12-19 Thread Winston Chang
(Sorry, this was previously sent with HTML mail. Resending in plain text.) I've been seeing warnings when unloading packages. They can be seen with the shiny and sp packages, among others (this is on R 3.0.2). For example: library(sp) unloadNamespace('sp') Warning messages: 1: In FUN(X[[2L]],

Re: [Rd] Strange warnings when unloading packages with S4 classes

2013-12-19 Thread Winston Chang
Excellent, thanks. -Winston On Thu, Dec 19, 2013 at 1:22 PM, John Chambers j...@r-project.org wrote: Previously reported and fixed in 3.0.2-patched (Bug 15481). Unless there is a 3.0.3, you will have to wait for 3.1.0. On Dec 19, 2013, at 10:19 AM, Winston Chang winstoncha...@gmail.com

[Rd] Internally accessing ref class methods with .self$x is different from .self[['x']]

2013-10-16 Thread Winston Chang
When a reference class method is accessed with .self$x, it has different behavior from .self[['x']]. The former copies the function to the object's environment (with some attributes attached), and the latter just return NULL (unless it has already been accessed once with .self$x). Is this how it's

Re: [Rd] Internally accessing ref class methods with .self$x is different from .self[['x']]

2013-10-16 Thread Winston Chang
On Wed, Oct 16, 2013 at 3:41 PM, Gabriel Becker gmbec...@ucdavis.edu wrote: Winston, (back on list since I found some official info) Looks like the behavior you are seeing is documented-ish Only methods actually used will be included in the environment corresponding to an individual

Re: [Bioc-devel] shiny, Bioconductor, and reproducible research

2013-07-31 Thread Winston Chang
On Mon, Jul 29, 2013 at 4:46 PM, Dan Tenenbaum dtene...@fhcrc.org wrote: Hi Winston, On Mon, Jul 29, 2013 at 2:39 PM, Winston Chang wins...@stdout.org wrote: Hi everyone - Great to hear from you all on your thoughts about Shiny. I've tried to answer some of Dan's questions below

[Rd] Odd behavior of symbol objects with classes/attributes

2013-06-17 Thread Winston Chang
I've been trying to add classes and attributes to symbol objects (created with quote()), and the behavior is very strange, as illustrated in the examples below. If symbols aren't meant to have classes and attributes attached to them, then perhaps R should throw errors when you attempt to do it?

Re: [Rd] Odd behavior of symbol objects with classes/attributes

2013-06-17 Thread Winston Chang
Thanks for the feedback, that clears things up. -Winston On Mon, Jun 17, 2013 at 1:29 PM, luke-tier...@uiowa.edu wrote: On Mon, 17 Jun 2013, Duncan Murdoch wrote: On 17/06/2013 1:01 PM, Winston Chang wrote: I've been trying to add classes and attributes to symbol objects (created

Re: [Rd] strange value in .Last.value

2013-06-04 Thread Winston Chang
This is the result of the withVisible() function, which is called by source(). This should illustrate what it does: withVisible(1+1) $value [1] 2 $visible [1] TRUE withVisible(invisible(1+1)) $value [1] 2 $visible [1] FALSE -Winston On Tue, Jun 4, 2013 at 3:25 PM, Andreas Leha

Re: [Rd] Mirroring R on a DVCS

2013-03-24 Thread Winston Chang
Thanks, it should be fixed now. On Sun, Mar 24, 2013 at 9:33 AM, Laurent Gautier lgaut...@gmail.com wrote: Hi again, The branch R-3-0-branch appears to be missing from the mirror. Best, Laurent On 2013-03-16 21:38, Winston Chang wrote: The Github mirror isn't affiliated with R-core

Re: [Rd] Mirroring R on a DVCS

2013-03-16 Thread Winston Chang
The Github mirror isn't affiliated with R-core developers -- it just fetches the changes from the R SVN repository periodically. Changes won't go upstream to the main SVN repository, and that's probably why there aren't very many forks of the Github repo. -Winston On Sat, Mar 16, 2013 at 1:44

Re: [Rd] double bracket stripping names

2013-02-26 Thread Winston Chang
This discussion reminds me of another disanalogy in vector/list double/single-bracket numeric/named indexing. First, here's what happens when the item is present. The behavior is consistent (or at least makes sense) across the different ways of getting the value from vectors and lists: # Named

Re: [Rd] Bug in mclapply?

2012-12-11 Thread Winston Chang
(Sorry for the repeat message; I forgot to send the previous message in plain text.) I've been using mclapply and have encountered situations where it gives errors or returns incorrect results. Here's a minimal example, which gives the error on R 2.15.2 on Mac and Linux: library(parallel) f -

[Rd] Bug in mclapply?

2012-12-10 Thread Winston Chang
I've been using mclapply and have encountered situations where it gives errors or returns incorrect results. Here's a minimal example, which gives the error on R 2.15.2 on Mac and Linux: library(parallel) f - function(x) NULL mclapply(1, f, mc.preschedule = FALSE, mc.cores = 1) # Error in

Re: [Rd] install.packages() fails if .libPaths() set

2012-10-30 Thread Winston Chang
It appears that this problem only happens when R_LIBS is specified in ~/.Renviron. When it compiles 'relations', it's somehow not passing along the correct lib paths. This is the test code: dir.create(test) .libPaths(test) install.packages(relations, type = source) The 'relations' package

Re: [Rd] Problems with install.packages when Ncpus 1

2012-10-06 Thread Winston Chang
In the code for install.packages, I see that if Ncpus1, it passes the Ncpus to make, as in 'make -k -j 32'. Is it possible that these packages are failing because of this option to make? It is perfectly correct option: please do your homework before posting as the posting guide asked of

[Rd] Problems with install.packages when Ncpus 1

2012-10-05 Thread Winston Chang
I have a Ubuntu Linux 12.04.1 machine running R 2.15.1. I'm trying to run tests building packages, so install.packages() is trying to install about about 1000 packages from source. I'm running into some strange issues that seem related to using values for Ncpus other than 1. When I use Ncpus=32,

[Rd] Environment when NextMethod is used

2012-09-01 Thread Winston Chang
I'm running into some hard-to-understand behavior with the evaluation environment when NextMethod is used. I'm using square-bracket indexing into objects, and the evaluation environment of the expression inside the square brackets seems to change depending on what kind of comparison operators are

Re: [Rd] rdyncall fears removal from CRAN

2012-08-20 Thread Winston Chang
On Mon, Aug 20, 2012 at 4:05 AM, Daniel Adler dad...@uni-goettingen.de wrote: Dear R Core and CRAN Team, I received a warning that the rdyncall package [1] will be archived and removed from the main CRAN distribution at 7th of September if I can not get rid of .Internal calls. From:

Re: [Rd] Quiz: How to get a named column from a data frame

2012-08-18 Thread Winston Chang
This isn't super-concise, but has the virtue of being clear: nv - c(a=1, d=17, e=101) df - as.data.frame(cbind(VAR = nv)) identical(nv, setNames(df$VAR, rownames(df))) # TRUE It seems to be more efficient than the other methods as well: f1 - function() setNames(df$VAR, rownames(df)) f2 -

[Rd] Using .onUnload to unload DLLs

2012-07-24 Thread Winston Chang
I've noticed that many of the base R packages have an .onUnload() function which automatically unloads compiled shared libraries with library.dynam.unload(). For example: stats:::.onUnload function (libpath) library.dynam.unload(stats, libpath) bytecode: 0x1033b9c30 environment: namespace:stats

[Rd] Finding dynamic shared libraries loaded with a package

2012-07-23 Thread Winston Chang
Is there a way to query a package to see what dynamic shared libraries are loaded with it? The reason I ask is because during development, I want to unload libraries so that they can be reloaded without restarting R. I want to make it automatic so that you can just pass in the name of the

Re: [Rd] Finding dynamic shared libraries loaded with a package

2012-07-23 Thread Winston Chang
On Mon, Jul 23, 2012 at 7:47 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, Jul 23, 2012 at 8:29 PM, Winston Chang winstoncha...@gmail.com wrote: Is there a way to query a package to see what dynamic shared libraries are loaded with it? This gives a DLLInfoList class

[Rd] Negative years with strptime?

2012-07-10 Thread Winston Chang
Is there a way to make as.Date() and strptime() process strings with negative years? It appears that Date objects can contain negative years and you can convert them to strings, but you can't convert them back to Date objects. x - as.Date(c(0001-01-24, 0500-01-24)) as.character(x) # 0001-01-24

Re: [Rd] Negative years with strptime?

2012-07-10 Thread Winston Chang
would have some sort of real problem. Anyway, this doesn't look right. Rui Barradas Em 10-07-2012 22:17, Winston Chang escreveu: Is there a way to make as.Date() and strptime() process strings with negative years? It appears that Date objects can contain negative years and you can convert

Re: [Rd] Incompatible methods for overloaded operator

2012-06-25 Thread Winston Chang
, this is not a workaround. It will go with the more oop-ish design. kohske 2012/6/21 Winston Chang winstoncha...@gmail.com: On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan mtmor...@fhcrc.org wrote: On 06/20/2012 08:06 PM, Hadley Wickham wrote: But aren't the methods compatible? If equality doesn't make

Re: [Rd] Incompatible methods for overloaded operator

2012-06-20 Thread Winston Chang
On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan mtmor...@fhcrc.org wrote: On 06/20/2012 08:06 PM, Hadley Wickham wrote: But aren't the methods compatible? If equality doesn't make a method compatible what does? Actually I guess that turns out to be the key (to why they work at the

[Rd] Incompatible methods for overloaded operator

2012-06-14 Thread Winston Chang
I'm trying to overload an operator, and I'm running into a strange problem. It happens when I install and load the package, but not when I simply source() the code. I'm defining + for two classes. The R code looks like this: #' @export #' @method + a `+.a` - function (x1, x2) {