Hopefully a member of the CRAN team will tell me I'm wrong, but I
think whether or not there is a compiler bug is ultimately irrelevant
-- packages on CRAN must compile cleanly even with potentially-buggy
development versions of compilers.
So, whether or not there is a bug in gcc is moot -- you'll
Hi Alexey,
It's kind of gross, but if you need a local solution, you could put
your own executable `cp` script on your PATH somewhere, and have that
do something "smart" when it's invoked by R. One way to detect that
would be to check if the `R_CMD` environment variable is set. For
example:
https
; thanks.
On Sat, Jul 6, 2024 at 8:09 PM Ivan Krylov wrote:
>
> On Fri, 5 Jul 2024 15:27:50 +0800
> Kevin Ushey wrote:
>
> > A common idiom in the R sources is to convert objects between LANGSXP
> > and LISTSXP by using SET_TYPEOF. However, this is soon going to be
&g
Hi,
A common idiom in the R sources is to convert objects between LANGSXP
and LISTSXP by using SET_TYPEOF. However, this is soon going to be
disallowed in packages. From what I can see, there isn't currently a
direct way to convert between these two object types using the
available API. At the R l
IMHO, this should be changed in both Rcpp and downstream packages:
1. Rcpp could check for out-of-bounds accesses in cases like these, and
emit an R warning / error when such an access is detected;
2. The downstream packages unintentionally making these out-of-bounds
accesses should be fixed to a
On Thu, Apr 25, 2024 at 4:24 AM Ivan Krylov via R-devel
wrote:
>
> On Wed, 24 Apr 2024 15:31:39 -0500 (CDT)
> luke-tierney--- via R-devel wrote:
>
> > We would be better off (in my view, not necessarily shared by others
> > in R-core) if we could get to a point where:
> >
> > all entry point
For cases like these, I think it would be more useful to have some
mechanism for associating URLs / hosts with credentials, and have R use
those credentials by default whenever accessing those URLs. Since
download.file() now supports custom headers, this could be a mechanism for
setting headers to
Just to rule it out... is it possible that R is listing these files
successfully, but is not printing the Chinese characters in those
names for some reason?
Using your example, what is the output of:
f <- list.files(a, recursive = T)
nchar(f)
Does the reported number of characters match
FWIW, it's possible to get fairly close to your proposed semantics
using the existing metaprogramming facilities in R. I put together a
prototype package here to demonstrate:
https://github.com/kevinushey/dotty
The package exports an object called `.`, with a special `[<-.dot` S3
method which
Hi Antoine,
Maybe I'm misunderstanding, but I think the warning is saying that
you've declared the package dependency in the DESCRIPTION file, but
you haven't actually imported the package (or any functions) in your
package NAMESPACE file?
I put together an example package that I think satisfies
For what it's worth, you can also get 90% of the way there with:
f <- glue::glue
f("if you squint, this is a Python f-string")
Having this in an add-on package also makes it much easier to change
in response to user feedback; R packages have more freedom to make
backwards-incompatible cha
You can see this a bit more clearly with e.g.
> storage.mode(byy)
[1] "list"
> storage.mode(byy.empty)
[1] "logical"
So even though both objects have S3 class "by", they have a different
underlying internal storage mode (as simplifying the result of 'by'
has given you a 0-length logical, instead
Do you see this same hang in a build of R with debug symbols? Can you
try running R with GDB, or even WinDbg or another debugger, to see
what the call stack looks like when the hang occurs? Does the hang
depend on the number of threads used by OpenBLAS?
On the off chance it's relevant, I've seen h
Hello,
I spotted a small typo recently in R-devel:
$ rg "htto://"
src/modules/internet/internet.c
95: warning(_("the 'wininet' method of url() is deprecated for
htto:// and https:// URLs"));
I suspect 'htto://' should read 'http://'.
Thanks,
Kevin
__
Strictly speaking, I don't think this is a "corrupt" representation,
given that any APIs used to access that internal representation will
call abs() on the row count encoded within. At least, as far as I can
tell, there aren't any adverse downstream effects from having the row
names attribute encod
I agree with Duncan that the right solution is to wrap the pipe
expression with parentheses. Having the parser treat newlines
differently based on whether the session is interactive, or on what
type of operator happens to follow a newline, feels like a pretty big
can of worms.
I think this (or som
IMHO the use of anonymous functions is a very clean solution to the
placeholder problem, and the shorthand lambda syntax makes it much
more ergonomic to use. Pipe implementations that crawl the RHS for
usages of `.` are going to be more expensive than the alternatives. It
is nice that the `|>` oper
Did you test with R 4.0.2 or R-devel? A bug related to this issue was
recently fixed:
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17833
Best,
Kevin
On Mon, Jun 29, 2020 at 11:51 AM Duncan Murdoch
wrote:
>
> On 29/06/2020 10:39 a.m., Johannes Rauh wrote:
> > Dear R Developers,
> >
> > I
Hi Juan,
For bug reports to R, you should attempt to create a
minimally-reproducible example, using only R's builtin facilities and
not any other addon packages. Given your report, it's not clear
whether the issue lies within renv or truly is caused by a change in R
4.0.0.
Also note that you have
That's great to see, although I suspect it's still a speculative
change and could be backed out if any non-trivial issues were
encountered.
Regardless, I would like to thank R core, CRAN, and Jeroen for all of
the time that has gone into creating and validating this new
toolchain. This is arduous
Hello,
Has a decision been made yet as to whether R 4.0.0 on Windows is going
to be built using the new gcc8 toolchain (described at
https://cran.r-project.org/bin/windows/testing/rtools40.html)?
>From the sidelines, I can see that the toolchain is being used to
build and test packages on CRAN; i
IMHO, if base R were to include a pipe operator, I think it should be much
simpler than the magrittr pipe. It should satisfy the property that:
x |> f(...) is equivalent to f(x, ...)
Except, perhaps, in terms of when the promise for 'x' gets forced. We
shouldn't need to mess with bindings
See also: https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16710
On Fri, Aug 30, 2019 at 9:02 AM William Dunlap via R-devel
wrote:
>
> Precedence is a property of the parser and has nothing to do with the
> semantics assigned to various symbols. Using just core R functions you can
> see the p
When RStudio builds the Environment pane, it will evaluate some R code
on objects in your global environment (as you have seen). In
particular, for better or worse, it calls `str()` on objects in the
global environment, to get a short text summary of the object.
So, to reproduce what you're seeing
Hi Jiefei,
Calling into R from C++ code is more complicated than one might think.
Please see Tomas Kalibera's post here:
https://developer.r-project.org/Blog/public/2019/03/28/use-of-c---in-packages/index.html
The Rcpp Function class is more expensive than a regular Rf_eval()
because it tries to
I think a more productive conversation could be: what additions to R
would allow for user-defined types / classes that behave just like the
built-in vector types? As a motivating example, one cannot currently
use the 64bit integer objects from bit64 to subset data frames:
> library(bit64); mtca
I think it's worth saying that mclapply() works as documented: it
relies on forking, and so doesn't work well in environments where it's
unsafe to fork. This is spelled out explicitly in the documentation of
?mclapply:
It is strongly discouraged to use these functions in GUI or embedded
environmen
I think it's also worth saying that some of these issues affect C code
as well; e.g. this is not safe:
FILE* f = fopen(...);
Rf_eval(...);
fclose(f);
whereas the C++ equivalent would likely handle closing of the file in
the destructor. In other words, I think many users just may not b
I think that object.size() is most commonly used to answer the question,
"what R objects are consuming the most memory currently in my R session?"
and for that reason I think returning the size of the internal
representations of objects (for e.g. ALTREP objects; unevaluated promises)
is the right d
I think this would be a good change. I think most users use the
'methods(class = <...>)' function to answer the question, "what
methods can I call on objects with these classes?", and in that
context I think it would be sensible for the function to accept more
than one class.
Kevin
On Wed, Oct 17
FWIW I can reproduce on macOS with R 3.5.1. A smaller example:
system2("ls", timeout = 5); x <- sample(1:1E8)
If I try to interrupt R while that sample call is running, R itself is closed.
Best,
Kevin
On Fri, Sep 14, 2018 at 10:53 AM Emil Bode wrote:
>
> I hope it's not too specific in my
More generally, I think one of the issues is that R is not yet able to
decrement a reference count (or mark a 'shared' data object as
'unshared' after it knows only one binding to it exists). This means
passing variables to R closures will mark that object as shared:
x <- list()
.Internal(
mas Kalibera wrote:
>
> Thanks, I can now reproduce and it is a bug that is easy to fix, I will do so
> shortly.
>
> Fyi it can be reproduced simply by running these two lines in Rgui:
>
> list()
> encodeString("apple")
>
> Best
> Tomas
>
> On 07/17/2
the escapes on R-devel. Please clarify the
> example if you believe it is a bug. Please also use current R-devel
> (I've relatively recently fixed a bug in decoding these escaped strings,
> perhaps unlikely, but not impossible it could be related).
>
> Best
> Tomas
>
> O
Given the following R script:
x <- 1
print(list())
save(x, file = tempfile())
output <- encodeString("apple")
print(output)
If I source this script from RGui on Windows, I see the output:
> source("encoding.R")
list()
[1] "\002ÿþapple\003ÿþ"
That is, it's as though R has
Of course, right after writing this e-mail I tested on my Windows
machine and did not see what I expected:
> charToRaw(before)
[1] c3 a9
> charToRaw(after)
[1] e9
so obviously I'm misunderstanding something as well.
Best,
Kevin
On Sat, Feb 17, 2018 at 2:19 PM, Kevin Ushey wrote
before <- iconv('é', to = "UTF-8")
cat(before, file = conn, sep = "\n")
after <- readLines(conn)
charToRaw(before)
charToRaw(after)
with output:
> charToRaw(before)
[1] c3 a9
> charToRaw(after)
[1] c3 a9
Best,
Kevin
I suspect your UTF-8 string is being stripped of its encoding before
write, and so assumed to be in the system native encoding, and then
re-encoded as UTF-8 when written to the file. You can see something
similar with:
> tmp <- 'é'
> tmp <- iconv(tmp, to = 'UTF-8')
> Encoding(tmp) <- "
For what it's worth, the Windows installers for other programming
language runtimes often install outside of Program Files, so at least
there is 'prior art' to motivate having R install directly into the
root of the home drive:
- ActiveState Perl installs directly C:/Perl;
- Python install
The Free Software Foundation maintains a list of free and GPL-compatible
software licenses here:
https://www.gnu.org/licenses/license-list.en.html#Unlicense
It appears that Unlicense is considered a free and GPL-compatible license;
however, the page does suggest using CC0 instead (which is indeed
IMHO the strongest argument for suppressing the warning message here is the
fact that
requireNamespace("foo", quietly = TRUE)
does not emit any warning message when the package 'foo' does not exist.
On Thu, Dec 8, 2016 at 12:51 PM, Dan Tenenbaum
wrote:
> Well, I'm getting a warning (not an
For reference, running your code in a build of R-devel with sanitizers:
> x <- vector(mode="list", length=3e9)
memory.c:2747:27: runtime error: signed integer overflow: 2147483647 + 1
cannot be represented in type 'R_len_t' (aka 'int')
SUMMARY: AddressSanitizer: undefined-behavior memory.c:2747:27
Hi R-devel,
One of the more common issues that new R users see, and become stumped
by, is error messages during package load of the form:
> library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
versionCheck = vI[[j]]) :
there is no package called 'Rcpp'
Error: package o
it owned the function or some of the
> classes.)
>
> R could adopt a different model for generic functions, where a package that
> defined a method for a non-exported class would create a "local" version of
> the generic, but that would likely raise some other issues.
&g
namespace: digest
> methods:::.requirePackage("digest")
> "digest" %in% loadedNamespaces()
[1] TRUE
> "package:digest" %in% search()
[1] FALSE
This may be intentional, but the behavior seems surprising and could
be responsible for the behav
age's namespace, not within the package environment, it is
not resolved, and so lookup fails. (Presumedly, that lookup is done
when initially building a cache for S3 dispatch?) So, I wonder if that
class lookup should occur within the package's namespace instead?
Thanks for your time,
On Wed, Jul 20, 2016 at 3:52 AM, Martin Maechler
wrote:
>>>>>> Jeroen Ooms
>>>>>> on Wed, 20 Jul 2016 10:26:19 +0200 writes:
>
> > On Tue, Jul 19, 2016 at 6:46 PM, Kevin Ushey
> wrote:
> >> R fails to install a package from
R fails to install a package from source over a pre-existing package
when the path to that package is a symlink, rather than a directory. A
reproducible example to illustrate (using MASS as an example):
# create a temporary R library in tempdir
library <- tempfile()
if (!dir.exists(lib
Hi,
(sorry for the wall of text; the issue here appears to be rather complicated)
I'm seeing a somewhat strange case where checking whether an S4 object
inherits from a parent class defined from another package with
'inherits' fails if that object is materialized through a call to
'load'. That's
Thanks for looking into this so promptly!
Should users expect the behaviour to be congruent across all of the
supported external programs (curl, wget) as well? E.g.
URL <- "http://cran.rstudio.org/no/such/file/here.tar.gz";
download <- function(file, method, ...)
print(download.file
that R-core
is aware of.
Thanks, and apologies again for the spam,
Kevin
On Tue, Aug 25, 2015 at 2:41 PM, Kevin Ushey wrote:
> In fact, this does reproduce on R-devel:
>
> > options(download.file.method = "libcurl")
> > options(repos = c(CRAN = "https
s unspecified)
Error in install.packages : Line starting 'https://cran.fhcrc.org`.
Kevin
On Tue, Aug 25, 2015 at 1:33 PM, Martin Morgan wrote:
> On 08/25/2015 01:30 PM, Kevin Ushey wrote:
>>
>> Hi Martin,
>>
>> Indeed it does (and I should have confirmed myself w
Hi Martin,
Indeed it does (and I should have confirmed myself with R-patched and
R-devel before posting...)
Thanks, and sorry for the noise.
Kevin
On Tue, Aug 25, 2015, 13:11 Martin Morgan wrote:
> On 08/25/2015 12:54 PM, Kevin Ushey wrote:
> > Hi all,
> >
> > The follo
Hi all,
The following fails for me (on OS X, although I imagine it's the same
on other platforms using libcurl):
options(download.file.method = "libcurl")
options(repos = c(CRAN = "https://cran.rstudio.com/";, CRANextra =
"http://www.stats.ox.ac.uk/pub/RWin";))
install.packages("latti
You should be able to set PKG_FCFLAGS="-fno-stack-protector" when
compiling to ensure that the stack protector is not used.
(Trying that out on a Windows VM, with a simple `R CMD build` + `R CMD
INSTALL`, compilation of your package succeeded but linking failed
saying the DLL 'Fpi' was not found;
My best guess is that it could be related to this commit:
https://github.com/wch/r-source/commit/14f904c32a44010d4dfb8a829805648a88c22f53,
since that's the only change that's touched `rapply` lately.
On Wed, Jul 15, 2015 at 12:35 PM, Dayne Filer wrote:
> In 3.1.2 eval does not store the result of
I like the idea of supporting a small, strict subset of Markdown that
can be used to translate from NEWS.md to NEWS.
Following from Yihui's example, it would be pretty easy to write a
parser in R for such a format (and I'd be willing to try implementing
one, if that would be of interest).
Kevin
It's hard to diagnose this without your package sources / a
reproducible example.
Shot in the dark: one thing worth checking is that you don't have an
entry in your `.Rbuildignore` that's removing files you don't expect
it to (maybe that's causing R to strip out the 'doc/index.html' file)
Kevin
Hi Jeroen,
I think `pipe` might just be returning the status code of the
underlying command executed; for example, I get a status code of '0'
when I test a pipe on `ls`:
conn <- pipe("ls")
stream <- readLines(conn)
print(close(conn))
Similarly, I get an error code if I try to `ls` a
One other solution that's only a little crazy: you could have a R
function within your package that generates the appropriate (portable)
Makevars, and within the package `configure` script call that
function. For example"
R --vanilla --slave -e "source('R/makevars.R'); makevars()"
And that 'm
In `?names`:
If ‘value’ is shorter than ‘x’, it is extended by character ‘NA’s
to the length of ‘x’.
So it is as documented.
That said, it's somewhat surprising that both NA and "" serve as a
placeholder for a 'missing name'; I believe they're treated
identically by R under the hood (e
On Mon, Jan 19, 2015 at 12:34 PM, Felipe Balbi wrote:
> Hi,
>
> On Mon, Jan 19, 2015 at 03:31:32PM -0500, Duncan Murdoch wrote:
>> >>> git has an interface for cloning SVN repositories into git
>> >>> which some users might decide to use. For those users'
>> >>> surprise, the repository will alway
I believe the question here is related to the sign on the compact row
names representation: why is it sometimes `c(NA, )` and
sometimes `c(NA, )` -- why the difference in sign?
To the best of my knowledge, older versions of R used the signed-ness
of compact row.names to differentiate between diffe
E.g. I am seeing:
dir <- file.path(tempdir(), "test-tar")
dir.create(dir)
setwd(dir)
dir.create("foo", showWarnings = FALSE)
file.create("foo/bar.R")
tar("test.tar", files = "foo/bar.R")
dir.create("untarred")
untar("test.tar", exdir = "untarred")
list.files("
Hi R-devel,
The following code:
all.equal(baseenv(), baseenv())
gives the error when run in a clean R session with latest R-devel (r66650):
kevin:~$ R --vanilla --slave -e "all.equal(baseenv(), baseenv())"
Error in all.equal.envRefClass(target[[i]], current[[i]],
check.attributes =
Hi Randall,
I notice that, in your .Rbuildignore, you have the entry:
^build$
and I suspect this is the culprit (having being bitten by a similar
problem before). Some part of the R build / install process creates /
uses that directory, but having it excluded in .Rbuildignore will
cause you
Hi R-devel,
In this commit:
https://github.com/wch/r-source/commit/c67a107dd7b0f074cec9359b8e2ca07c6243283c
R_running_as_main_program was moved from Rmain.c to Rinterface.h, and lost
its 'extern' declaration. This change is causing us linker problems (since
we now have duplicate symbols for R_run
Hi R-devel,
I'm noticing the following behaviour:
writeLines("#include ", file = "test.cpp")
Rcpp::sourceCpp("~/test.cpp") ## succeeds at trivial compile
Sys.setenv("USE_CXX1X" = "yes")
Rcpp::sourceCpp("~/test.cpp") ## fails; CXX nor CXX1X properly set (?)
IIUC, R is not propagat
e into the language
lawyer land of C/C++ standards, so let's all just agree that, regardless of
what the correct interpretation is, 'i = i++' and 'i = ++i' are just things
you shouldn't write :)
Cheers,
Kevin
On Tue, Jun 24, 2014 at 3:38 PM, Hervé Pagès wrote
`lapply` basically takes its call and massages into calls of the following form:
FUN(X[[1L]], ...)
FUN(X[[2L]], ...)
...
that get evaluated in the appropriate environment.
For `lapply(list(list(a=3,b=4)),"$","b")`, you can imagine that a
function `FUN` of the form:
FUN <- funct
I don't see what's so surprising here.
That statement is identical to writing:
if (arrMask[i] == 1) {
numsels = ++numsels;
} else {
numsels = numsels;
}
and
numsels = ++numsels;
has two statements modifying the value of numsels (= and prefix-++) in
a single sequ
Henrik,
If I understand correctly, you want something along the lines of
(following your example):
foo <- function(expr) {
if (!is.language(expr)) substitute(expr)
else expr
}
## first example
expr0 <- foo({ x <- 1 })
expr1 <- foo(expr0)
stopifnot(identical(ex
Suppose I generate an integer vector with e.g.
SEXP iv = PROTECT(allocVector(INTSXP, 100));
and later want to shrink the object, e.g.
shrink(iv, 50);
would simply re-set the length to 50, and allow R to reclaim the
memory that was previously used.
Is it possible to do this while respec
The safest way is to check the length of the row.names attribute, e.g.
length(getAttrib(df, R_RowNamesSymbol)).
This protects you from both data.frames with zero columns, as well as
corrupted data.frames containing columns with different lengths, since
by definition the number of rows in a da
I too think it would be useful if R exported some version of its
string sorting routines, since sorting strings while respecting
locale, and doing so in a portable fashion while respecting the user's
environment, is not trivial. R holds a fast, portable, well-tested
solution, and I think package de
2_set(y,a,b)\
>>> if (ISNA (a) || ISNA (b)) y = NA_REAL;\
>>> else if (ISNAN(a) || ISNAN(b)) y = R_NaN;
>>>
>>> Other R functions, like the basic arithmetic operations +-/*^,
>>> do not (search for PLUSOP in src/main/arithm
ike the basic arithmetic operations +-/*^,
>> do not (search for PLUSOP in src/main/arithmetic.c).
>> They just let the hardware do the calculations.
>> As a result, you can get odd results like
>> > is.nan(NA_real_ + NaN)
>> [1] FALSE
>> > is.nan(NaN + NA_re
e R help files help(is.na) and help(is.nan) suggest that
> computations involving NA and NaN are indeterminate.
>
> It is faster to use the R convention; most operations are just
> handled by the hardware, without extra work.
>
> In cases like sum(x, na.rm=TRUE), the help file specifies that b
Hi R-devel,
I have a question about the differentiation between NA and NaN values
as implemented in R. In arithmetic.c, we have
int R_IsNA(double x)
{
if (isnan(x)) {
ieee_double y;
y.value = x;
return (y.word[lw] == 1954);
}
return 0;
}
ieee_double is just used for type punning so w
This behaviour is fixed in R-devel (tested with r64727)
> format( data.frame() )
data frame with 0 columns and 0 rows
-Kevin
On Thu, Jan 23, 2014 at 11:59 PM, Yihui Xie wrote:
> Hi,
>
> Here seems to be a corner case in which format() fails:
>
>> format(data.frame())
> Error in .subset2(x, i, e
I think the key word here is _other_ packages. It's entirely okay to call
your package's own compiled code through the .Call interface (and the code
you write may link to other packages; the obvious example being Rcpp code
you write); however, it is not portable to use .Call to call compiled code
f
81 matches
Mail list logo