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
cloud.r-project.o
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.
id
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
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 assumption is that if
> you a
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 no
se post them.
> The CRAN machine uses the tools that 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 hav
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 m
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(), whic
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 a
Thanks for looking into it. Is there a way to avoid the HEAD request
in R 3.3.0? I'm asking because if there isn't, then I'll add a
workaround in a package I'm working on.
-Winston
On Tue, Jun 21, 2016 at 9:45 PM, Martin Morgan
wrote:
> On 06/21/2016 09:35 PM, Winston
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 happenin
>
>
>> 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 -> 0x
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
(https://github.com/wch/r-source/blob/
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
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) {
local(sys.calls())
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 commit
th pool (@test-scheduling.R#31)
Error: testthat unit tests failed
Execution halted
==
On Mon, Apr 3, 2017 at 10:34 AM, Winston Chang 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
>
>
>>
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 variab
)
On Wed, Apr 5, 2017 at 2:59 AM, Martin Maechler
wrote:
>
> >>>>> Winston Chang
> >>>>> on Tue, 4 Apr 2017 15:29:40 -0500 writes:
>
> > I've done some more investigation into the problem, and it is very
> > difficult t
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 case, it coincided with
> my
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 Behalf Of Winston
> Chang
> S
t$release() at testthat/test-scheduling.R:13
3: private$callback()
-Winston
On Wed, Apr 5, 2017 at 4:32 PM, Dirk Eddelbuettel wrote:
>
> On 5 April 2017 at 15:46, Winston Chang wrote:
> | On Wed, Apr 5, 2017 at 2:24 PM, Robert McGehee <
> rmcge...@walleyetrading.net>
> | wrote:
&g
>
> 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 th
>
> 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]]
__
R-
red in multithreaded
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 diag
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
ly how I encountered this issue in the first
place: when restarting R 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
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 st
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, wrote:
> On Tue, 21 Nov 2017, Winston Chang wrote:
>
>> Is it safe to call Rprintf and REprintf from a background thread? I'm
>> working on a
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 war
>> 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 sourc
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 D
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 ins
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
wrote:
>
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?
Thanks for the feedback, that clears things up.
-Winston
On Mon, Jun 17, 2013 at 1:29 PM, 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 sym
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
On Wed, Oct 16, 2013 at 3:41 PM, Gabriel Becker 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 object. To decla
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: I
(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]],
Excellent, thanks.
-Winston
On Thu, Dec 19, 2013 at 1:22 PM, John Chambers 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 wrote:
>
>> I
On Wed, Jan 22, 2014 at 10:55 AM, Brian Lee Yung Rowe wrote:
> 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 a source pac
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 mypa
On Tue, Feb 11, 2014 at 3:27 PM, Simon Urbanek
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 pass the right
> environm
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(fr
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 nev
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 packa
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
"Imports"
> instead then you need to re-export the generic "filter" function from
> your package namespace.
>
> You will also need to document the generic function in your package. A
> minimal functioning help page that cross-references to the dplyr package
> should be
On Thu, Jun 19, 2014 at 3:15 PM, Martyn Plummer 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 mailing list
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 wrote:
> On Fri, Aug 1, 2014 at 4:47 PM, Ross Boylan wrote:
> [...]
>> First, I'd like to understand more ab
On Tue, Aug 5, 2014 at 1:49 PM, Grant Rettke 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 ATTACH"
On Tue, Aug 5, 2014 at 4:37 PM, Grant Rettke 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")}
> │ base
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 assignm
So I assume there must be a bug somewhere in here.
-Winston
On Sun, Aug 10, 2014 at 8:46 PM, Winston Chang
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
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 identic
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 loo
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 re
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. Fo
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 chec
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 a
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
On Thu, Feb 26, 2015 at 2:09 PM, 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"
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
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.
===
Here's
On Tue, Apr 28, 2015 at 3:04 PM, Gábor Csárdi 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 to be clear: you m
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) {
message("Run
On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan 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
> command line b
lly, this is not a workaround.
> It will go with the more oop-ish design.
>
> kohske
>
> 2012/6/21 Winston Chang :
> > On Wed, Jun 20, 2012 at 10:49 PM, Martin Morgan
> wrote:
> >
> >> On 06/20/2012 08:06 PM, Hadley Wickham wrote:
> >>
> >
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
--01-01" "00/,-01-01"
> [16] "00/+-01-01" "00/*-01-01" "00/)-01-01" "00/(-01-01" "00/'-01-01"
> [21] "00.0-01-01" "00./-01-01"
>
> See the year number: "after" the zero, i.e., downward
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 package
On Mon, Jul 23, 2012 at 7:47 PM, Gabor Grothendieck wrote:
> On Mon, Jul 23, 2012 at 8:29 PM, Winston Chang
> wrote:
> > Is there a way to query a package to see what dynamic shared libraries
> are
> > loaded with it?
> >
>
> This gives a "DLLInfoList&q
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)
I've noticed that many other packages don't
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 <- f
On Mon, Aug 20, 2012 at 4:05 AM, Daniel Adler 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: rip...@stats.ox.ac.uk (
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 u
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, a
>> In the code for install.packages, I see that if Ncpus>1, 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 a
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' packa
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 sum(sap
(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 <- fu
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 in
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 PM
Thanks, it should be fixed now.
On Sun, Mar 24, 2013 at 9:33 AM, Laurent Gautier 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:
>
&g
85 matches
Mail list logo