If you are considering emulating the S/S+ which.na, which.nan,
etc., family of functions to save space you might also consider
the related anyMissing function (I don't know why it
isn't any.is.na to match the pattern). anyMissing(x) returns
the same result as any(is.na(x)) or length(which.na(x)) b
> -Original Message-
> From: r-devel-boun...@r-project.org
> [mailto:r-devel-boun...@r-project.org] On Behalf Of Duncan Murdoch
> Sent: Monday, March 23, 2009 5:28 PM
> To: Stavros Macrakis
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] dput(as.list(function...)...) bug
>
> On 23/03/2009
Doesn't Fortran still require that the arguments to
a function not alias each other (in whole or in part)?
I could imagine that var() might call into Fortran code
(BLAS or LAPACK). Wouldn you want to chance erroneous
results at a high optimization level to save a bit of
time in an unusual situati
t.org] On Behalf Of William Dunlap
> Sent: Monday, March 23, 2009 6:18 PM
> To: Wacek Kusnierczyk; r-devel@r-project.org
> Subject: Re: [Rd] [R] variance/mean
>
> Doesn't Fortran still require that the arguments to
> a function not alias each other (in whole or in part)?
&g
I think there are some missing words in "R Internals"'s description of
the P_ macro.
It currently has "A macro as a wrapper for ngettext", which I think
ought to be
something like "The macro P_ may be used as a wrapper for ngettext".
The following patch also makes the 2 alternate definitions of P_
I can reproduce the difference that Stefan saw, depending
on whether or not I start Rgui with the flags
--no-environ --no-Rconsole
I think it boils down to the isBlankString() function.
For the string "\247" it returns 1 when those flags are
not present and 0 when they are. isBlankString does
> TIBCO Software Inc - Spotfire Division
> wdunlap tibco.com =20
>
> > -Original Message-
> > From: Peter Dalgaard [mailto:p.dalga...@biostat.ku.dk]=20
> > Sent: Friday, April 10, 2009 2:50 PM
> > To: William Dunlap
> > Cc: r-b...@r-project.org; Rabe
It may have to do with the results of is.object():
> is.object(1*structure(1,class="testClass"))
[1] FALSE
> is.object(structure(1,class="testClass")*1)
[1] TRUE
> is.object(structure(1,class="testClass"))
[1] TRUE
is.object(x) should be true if x has a class attribute,
but 1*structut
Currently sub(perl=TRUE) allows you to specify \U and \L
in the replacement argument so that the rest of the subpatterns
in the line (the \\ things) will be converted to upper
or lower case, respectively. perl also also has a \E operator
to end these case conversions for the rest of the subpattern
Note that Kieren's example labelled the first
argument to try() with an improper label res30=,
not expr= (or is that a mailer turning something
into '30='?). If it really is an improper argument
tag then this could be showing a buglet in reporting
on wrongly named arguments:
> invisible(rm(x,y)
> -Original Message-
> From: l...@stat.uiowa.edu [mailto:l...@stat.uiowa.edu]
> Sent: Thursday, April 16, 2009 9:27 AM
> To: William Dunlap
> Cc: Dirk Eddelbuettel; Kieran O'Neill; r-devel@r-project.org
> Subject: Re: [Rd] How can I catch errors thrown from
"oops"))
[1] 1
Error in f(print(1), y = print(2), x = print(3), z = stop("oops")) :
oops
> f(print(1),y=print(2),z=print(3),x=stop("oops"))
[1] 1
[1] 3
Error in f(print(1), y = print(2), z = print(3), x = stop("oops")) :
unused argument(s) (1, z = 3)
Bill Dun
Since R 2.8.0 (and up to 2.10.0-devel, but not in 2.7.1),
if you call a function without a required argument and
the missing argument is first evaluated inside certain
.Primitive calls, then the error message about the missing
argument is different from the normal one and is harder
to understand.
I think the following rather wierd expressions show a problem in how
some of the .Primitive functions evaluate their arguments. I haven't
yet thought of a way that a nonabusive user might run into this problem.
In each case the first argument, x, is modified in the course of
evaluating the second
> -Original Message-
> From: l...@stat.uiowa.edu [mailto:l...@stat.uiowa.edu]
> Sent: Thursday, April 23, 2009 11:06 AM
> To: William Dunlap
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] reference counting problem in .Primitive's?
>
> On Thu, 23 Apr 2009, W
On Linux when I compile R 2.10.0(devel) (src/main/arithmetic.c in
particular)
with gcc 3.4.5 using the flags -g -O2 I get noncommutative behavior when
adding NA and NaN:
> NA_real_ + NaN
[1] NaN
> NaN + NA_real_
[1] NA
If I compile src/main/arithmetic.c without optimization (just -g)
th
> From: Martin Maechler [mailto:maech...@stat.math.ethz.ch]
> Sent: Friday, May 01, 2009 5:15 AM
> To: William Dunlap
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] NA_real_ NaN -> NA or NaN, should we care?
>
> >>>>> William Dunlap
> >>&
Original Message-
> From: r-devel-boun...@r-project.org
> [mailto:r-devel-boun...@r-project.org] On Behalf Of William Dunlap
> Sent: Friday, May 01, 2009 7:50 AM
> To: Martin Maechler
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] NA_real_ NaN -> NA or NaN, should we care
Try changing
static void (*fun)() = NULL;
to
DL_FUNC fun = NULL;
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 29, 2017 at 5:14 AM, Therneau, Terry M., Ph.D. <
thern...@mayo.edu> wrote:
> I've recently updated the coxme package, which calls internal routines
> from the bdsmatrix p
fun(nrow, nblock, bsize, bmat, rmat, nfrail, y);
}
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 29, 2017 at 8:48 AM, William Dunlap wrote:
> Try changing
> static void (*fun)() = NULL;
> to
> DL_FUNC fun = NULL;
>
> Bill Dunlap
> TIBCO Software
> wdunl
eturn type (two are
> int *), and Rdynload has
>
>typedef void * (*DL_FUNC)();
>
> Will this untruth mess anything up?
>
> Terry T.
>
> On 12/29/2017 10:52 AM, William Dunlap wrote:
>
> And remove the cast on the return value of R_GETCCallable. And check
>
One use case is when you want to extract every third item, starting with
the second, of an arbitrary vector with
x[c(FALSE, TRUE, FALSE)]
instead of
x[seq_along(x) %% 3 == 2]
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jan 4, 2018 at 11:56 AM, Ben Bolker wrote:
>
> Sorry if t
I have never used this construct. However, part of my job is seeing how
well CRAN packages work in our reimplementation of the R language
and I am continually surprised by the inventiveness of package writers.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jan 4, 2018 at 1:44 PM, Ben Bolke
The x and y passed to dgemm in that code are pointers to the same memory,
thus breaking Fortran's no-aliasing rule. Is it possible the MKL depends
on the
caller following that rule?
You might try dsyrk() instead of dgemm.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Jan 8, 2018 at 6:57
I believe that for a list as.character() applies deparse() to each element
of the list. deparse() does not preserve NA-ness, as it is intended to
make text that the parser can read.
> str(as.character(list(Na=NA, LglVec=c(TRUE,NA),
Function=function(x){x+1})))
chr [1:3] "NA" "c(TRUE, NA)" "func
-
> From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of Hervé
> Pagès
> Sent: Monday, January 22, 2018 2:01 PM
> To: William Dunlap ; Patrick Perry <
> ppe...@stern.nyu.edu>
> Cc: r-devel@r-project.org
> Subject: Re: [Rd] as.character(list(NA))
>
> On 0
SEXP eta = PROTECT(allocVector(REALSXP,H_c)); n_prot++;
double *eta_c; eta_c = REAL(eta);
for (i=0;i wrote:
> Hi
>
> I'm trying to develop some C code to find the fixpoint of a contraction
> mapping, the code compiles and gives the right results when executed in R.
> However R-gui session
In the fastmatch package, version 1.1-0, there is a C function called
"ctapply_", with a trailing underscore. However, the NAMESPACE's call to
useDynLib refers to "ctapply", without the trailing underscore.
% grep ctapply NAMESPACE {R,src}/*
NAMESPACE:useDynLib(fastmatch, C_fmatch = fmatch, C_cta
I think the problem in R-devel happens when there are non-ASCII characters
in any
of the strings passed to gsub.
txt <- vapply(list(as.raw(c(0x41, 0x6d, 0xc3, 0xa9, 0x6c, 0x69, 0x65)),
as.raw(c(0x41, 0x6d, 0x65, 0x6c, 0x69, 0x61))), rawToChar, "")
txt
#[1] "Amélie" "Amelia"
Encoding(txt)
#[1] "unk
I believe this has to do terms() making "term.labels" (hence the dimnames
of "factors")
with deparse(), so that the backquotes are included for non-syntactic
names. The backquotes
are not in the column names of the input data.frame (nor model frame) so
you get a mismatch
when subscripting the data
The problem occurs in the Windows GUI with the 'windows()' graphics device.
In the following example the red diagonal line appears in 3 plots but not
in the one
with xpd=TRUE and alpha.f=0.9.
> par(mfrow=c(2,2))
> for(xpd in c(FALSE, TRUE)) for(alpha.f in c(.9, 1))
plot(0:1,xpd=xpd,type="l",col=ad
data(package="survival") gives, in part,
cgd Chronic Granulotomous Disease data
cgd0 (cgd) Chronic Granulotomous Disease data
colon Chemotherapy for Stage B/C colon cancer
flchain Assay of serum free light chain for 7874
A coworker got tired of having to type 'yes' or 'no' after quitting R: he
never wanted to save the R workspace when quitting. So he added
assignInNamespace lines to his .Rprofile file to replace base::q with
one that, by default, called the original with save="no"..
utils::assignInNamespace(".q
R startup tweaking
> possibilities, notably via environment variables.
> [e.g., the current ways to pre-determine the active .libPaths() in R,
> and the fact the R calls R again during 'R CMD check' etc,
> sometimes drives me crazy when .libPaths() become incompatible
>
Recent versions of Windows will remove empty directories from areas that
Windows considers places for temporary files. It does not seem to matter
how old they are; empty directories are found and removred c. once a day.
I haven't seen any documentation on this feature but I think you can turn
if
You run into the same problem when using 'non-syntactical' names:
> mfB <- model.frame(y ~ `Temp(C)` + `Pres(mb)`,
data=data.frame(check.names=FALSE, y=1:10, `Temp(C)`=21:30,
`Pres(mb)`=991:1000))
> match(attr(terms(mfB), "term.labels"), names(mfB)) # gives NA's
[1] NA NA
> attr(terms(mfB), "ter
In R-3.5.0 you can use ...length():
> f <- function(..., n) ...length()
> f(stop("one"), stop("two"), stop("three"), n=7)
[1] 3
Prior to that substitute() is the way to go
> g <- function(..., n) length(substitute(...()))
> g(stop("one"), stop("two"), stop("three"), n=7)
[1] 3
R-3.5.0
[The package XML is labelled ORPHANED and a comment says the CRAN team
maintains it. I am not sure what address to send this to.]
In package XML version 3.98.1.11, RUtils.c registers the C function
RS_XML_xmlNodeChildrenReferences twice. The registration information is
identical but this could c
'Writing R Extensions', section 1.1.5, in the part about a package's 'inst'
directory, says that if NEW is in both the top level and in the inst
directory, the in inst will be installed:
Note that with the exceptions of INDEX, LICENSE/LICENCE and NEWS,
information files at the top level of the pac
Bugzilla issue 16101 describes another first-list-name-printed-differently
oddity
with the Windows GUI version of R:
> a <- "One is \u043E\u0434\u0438\u043D\nTwo is \u0434\u0432\u0430\n"
> Encoding(a) # expect "UTF-8"
[1] "UTF-8"
> sapply(strsplit(a, "\n")[[1]], charToRaw)[c(1,1,2)]
$`One is один`
vapply has a mandatory FUN.VALUE argument which specifies the type and size
of FUN's return value. This helps when you want to cover the 0-length case
without 'if' statements. You can change your apply calls to vapply calls,
but they will be a bit more complicated. E.g., change
apply(X=myMat
I tend to avoid the the trace/verbose arguments for the various root
finders and optimizers and instead use the trace function or otherwise
modify the function handed to the operator. You can print or plot the
arguments or save them. E.g.,
> trace(ff, print=FALSE, quote(cat("x=", deparse(x), "\n
AWYER WAITING TO
> MAKE YOU PAY", but I usually just satisfy myself with "Not at a
> minimum/root".
>
> Best, JN
>
> On 2018-08-13 06:00 PM, William Dunlap wrote:
> > I tend to avoid the the trace/verbose arguments for the various root
> finders
That was my first thought (my second was trace(.Deprecated,...)). However,
the spam authors don't use .Deprecated() or warning() to tell about
deprecated functions. See spam/R/deprecated.R:
validspamobject <- function( ...) {
#.Deprecated('validate_spam()')
message("`validspamobject()` i
Note that include/S.h contains
/*
This is a legacy header and no longer documented.
Code using it should be converted to use R.h
*/
...
/* is this a good idea? - conflicts with many versions of f2c.h */
# define longint int
S.h was meant to be used while converting to R C code
> the lack of a decimal place had historically not been significant
Version 4 of S (c. 1991) and versions of S+ based on it treated a sequence
of digits without a decimal point as integer.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sat, Aug 25, 2018 at 4:33 PM, Duncan Murdoch
wrote:
> O
Rich Calaway pointed out that S4 came out c. 1996-97, not 1991.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Aug 26, 2018 at 8:30 PM, William Dunlap wrote:
> > the lack of a decimal place had historically not been significant
>
> Version 4 of S (c. 1991) and versions of S+
Should the following two functions should always give the same result,
except for possible differences in the 'call' component of the warning
or error message?:
f0 <- function(x, y) x || y
f1 <- function(x, y) if (x) { TRUE } else { if (y) {TRUE } else { FALSE }
}
And the same for the 'and' v
The ratio of object size to rds file size depends on the object. Some
variation is due to how header information is stored in memory and in the
file but I suspect most is due to how compression works (e.g., a vector of
repeated values can be compressed into a smaller file than a bunch of
random by
R lets one lock an environment with both an R function,
base::lockEnvironment, and a C function, R_LockEnvironment, but, as far as
I can tell, no corresponding function to unlock an environment. Is this
omission on principle or just something that has not been done yet?
I ask because several pack
They can get bitten in the last two lines of this example, where the 'x'
argument is not first:
> d <- data.frame(C1=c(r1=11,r2=21,r3=31), C2=c(12,22,32))
> d[1,1:2]
C1 C2
r1 11 12
> `[`(d,j=1:2,i=1)
C1 C2
r1 11 12
Warning message:
In `[.data.frame`(d, j = 1:2, i = 1) :
named arguments othe
The NEWS file for R-devel (as of 2018-11-28 r75702) says
• order(, decreasing=c(TRUE,FALSE)) could fail in some cases.
Reported from StackOverflow via Karl Nordström.
However, either I don't understand the meaning of decreasing=c(TRUE,FALSE)
or there are still problems. I thought order
When formula() is applied to the output of model.frame() it ignores the
formula in the model.frame's 'terms' attribute:
> d <- data.frame(A=log(1:6), B=LETTERS[rep(1:2,c(2,4))], C=1/(1:6),
D=rep(letters[25:26],c(4,2)), Y=1:6)
> m0 <- model.frame(data=d, Y ~ A:B)
> formula(m0)
Y ~ A + B
>
t; John Fox, Professor Emeritus
> McMaster University
> Hamilton, Ontario, Canada
> Web: http::/socserv.mcmaster.ca/jfox
>
> > On Dec 21, 2018, at 2:51 AM, Martin Maechler
> wrote:
> >
> >>>>>> William Dunlap via R-devel
> >>>>>>
S-PLUS took it from S, sometime in the early 1990's. The "White Book"
("Statistical Models in S", Chambers and Hastie, eds.,1992), uses objects()
on p.88..
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jan 3, 2019 at 4:47 PM Peter Dalgaard wrote:
> As far as I remember, this comes from
I was installing the 'diffobj' package into TERR and got an error from the
call
StyleSummary <- setClass("StyleSummary",
slots=c(container="ANY", body="ANY", map="ANY"),
prototype=list(
container=function(x) sprintf("\n%s\n", paste0(x, collapse="")),
body=identity,
detail=function(x
To download a package with all its dependencies and install it, use the
install.packages() functions instead of 'R CMD INSTALL'. E.g., in bash:
mkdir /tmp/libJunk
env R_LIBS_SITE=libJunk R --quiet -e 'if
(!requireNamespace("purrr",quietly=TRUE)) install.packages("purrr")'
For corporate "producti
Microsoft R Open 3.4.2
The enhanced R distribution from Microsoft
Microsoft packages Copyright (C) 2017 Microsoft Corporation
Using the Intel MKL for parallel mathematical computing (using 12 cores).
Default CRAN mirror snapshot taken on 2017-10-15.
See: https://mran.microsoft.com/.
> f <- funct
The algorithm does make a differece. You can use Kahan's summation
algorithm (https://en.wikipedia.org/wiki/Kahan_summation_algorithm) to
reduce the error compared to the naive summation algorithm. E.g., in R
code:
naiveSum <-
function(x) {
s <- 0.0
for(xi in x) s <- s + xi
s
}
kahanSum
Rampal Etienne
wrote:
> Dear Will,
>
> This is exactly what I find.
> My point is thus that the sum function in R is not a naive sum nor a
> Kahansum (in all cases), but what algorithm is it using then?
>
> Cheers, Rampal
>
>
> On Tue, Feb 19, 2019, 19:08 William
Valgrind (without gctorture) reports memory misuse:
% R --debugger=valgrind --debugger-args="--leak-check=full --num-callers=18"
...
> x <- 1:20
> y <- rep(letters[1:5], length(x) / 5L)
> for (i in 1:1000) {
+ # x[y == 'a'] <- x[y == 'b']
+ x <- `[<-`(x, y == 'a', x[y == 'b'])
+ cat(i, '
format.Date runs into trouble long before Inf:
> as.Date("2018-03-05") + c(2147466052, 2147466053)
[1] "5881580-07-11" "-5877641-06-23"
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 5, 2019 at 2:33 PM Gabriel Becker wrote:
> Richard,
>
> Well others may chime in here, but from
I've been searching for patterns in why some POSIXlt objects have the zone
and gmtoff components and some don't and why gmtoff is sometimes NA when
the zone is known. Is there a pattern or is it just that the additional
fields and workarounds were added in an ad hoc way?
E.g., as.POSIXlt adds th
I think this goes back to SV4 (c. late 1990's). The is. functions
are much older (c. mid 1970's) , from before any class system was in S.
is() and inherits() were introduced with the S4 class system and were meant
to escape from the prison made by ancient design choices.
Bill Dunlap
TIBCO Softwa
integrate(f, xmin, xmax) will have problems when f(x) is 0 over large parts
of (xmin,xmax). It doesn't have any clues to where the non-zero regions
are. It computes f(x) at 21 points at each step and if all of those are
zero (or some other constant?) for a few steps, it calls it a day. If you
ca
In R-3.6.0 autoprinting was changed so that print methods for the storage
modes are not called when there is no explicit class attribute. E.g.,
% R-3.6.0 --vanilla --quiet
> print.function <- function(x, ...) { cat("Function with argument list ");
cat(sep="\n", head(deparse(args(x)), -1)); i
I think a machine-specific input, like the MAC address, to the UUID is
essential. S+ used to make a seed for the random number generator based on
the the current time and process ID. A customer complained that all
machines in his cluster generated the same random number stream. The
machines were
; print.complex <- function(x, ...) "complex vector"
3.6.0> 1+2i
[1] 1+2i
3.6.0> print(1+2i)
[1] "complex vector"
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, May 21, 2019 at 9:31 AM Martin Maechler
wrote:
> >>>>> William Dunlap via R-deve
polluting the global environment with print methods. Maybe
> it'd make sense to add getOption("autoprint") which should be set to
> a user- or environment- supplied function. That function would do the
> dispatch. I'd be happy to send a patch for this, if it makes sense
Note that R treats tildes in file names differently on Windows and Linux.
On Windows, it is only replaced if it it at the beginning of the line and
is followed by a forward or backward slash or end-of-line. On Linux it is
replaced no matter where it is in the text and ~someUser will be replaced
by
include/Rmath.h declares a set of 'logspace' functions for use at the C
level. I don't think there are core R functions that call them.
/* Compute the log of a sum or difference from logs of terms, i.e.,
*
* log (exp (logx) + exp (logy))
* or log (exp (logx) - exp (logy))
*
* without ca
This may be related to the size of the deparsed call in the error message
that Brodie and Luke were discussing recently on R-devel (" Mitigating
Stalls Caused by Call Deparse on Error"). I don't get a crash, but the
error message itself doesn't show up after the deparsed call.
> X <- sample(lett
If you can run things on LInux try running a few iterations of that loop
under valgrind, setting gctorture(TRUE) before the loop.
% R --debugger=valgrind --silent
> gctorture(TRUE)
> for(i in 1:5) { ... body of your loop ... }
valgrind can show memory misuse that eventually will cause R to crash.
Changing the default behavior of regmatches would break its use with
gregexpr, where
the number of matches per input element faries, so a zero-length character
vector
makes more sense than NA_character_.
> x <- c("John Doe", "e e cummings", "Juan de la Madrid")
> m <- gregexpr("[A-Z]", x)
> regmat
While poking around the C++ code in the dplyr package I ran across the idiom
Rf_defineVar(symbol, R_UnboundValue, environment)
to [sort of] remove 'symbol' from 'environment'
Using it makes the R-level functions objects(), exists(), and get()
somewhat inconsistent and I was wondering if that wa
I don't care much for regmatches and haven't tried strextract, but I think
replacing the character(0) by NA_character_ is almost always inappropriate
if the match information comes from gregexpr.
I think strcapture() does a pretty good job of what I think you are trying
to do. Perhaps adding an a
e(Name=character(), Address=character(),
stringsAsFactors=FALSE))
Name Address
1 Groucho grou...@marx.com
2 ch...@marx.com
3 Harpo
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Aug 15, 2019 at 1:04 PM William Dunlap wrote:
> I don't care much for regmatches and hav
Duncan Murdoch wrote:
> Scripts are for throwaways, not for anything worth keeping.
I totally agree and have a tangentially relevant question about the <<-
operator. Currently 'name <<- value' means to look up the environment
stack until you find 'name' and (a) if you find 'name' in some frame
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 precedence of '?' is between those of '=' and '<-'.
> # '=' has lower precedence than '?'
> str(as.list(parse(text="a ? b = c")[[1]]))
List of 3
Prior to R-3.6.0 the keys in the lazyload key files, e.g.
pkg/data/Rdata.rdx or pkg/R/pkg.rdx, seemed to all be 2-long integer
vectors. Now they can be lists. The ones I have seen have two components,
"eagerKey" is a 2-long integer vector and "lazyKeys" is a named list of
2-long integer vectors.
> Functions like lm() treat logical predictors as factors, *not* as
numerical variables.
Not quite. A factor with all elements the same causes lm() to give an
error while a logical of all TRUEs or all FALSEs just omits it from the
model (it gets a coefficient of NA). This is a fairly common situ
Look at section 6.1 of the R Installation and Admin manual.
6.1 Default packages
The set of packages loaded on startup is by default
> getOption("defaultPackages")
[1] "datasets" "utils" "grDevices" "graphics" "stats" "methods"
(plus, of course, *base*) and this can be changed by sett
Also, check the settings of R_HOME and/or R_LIBS.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Sun, Sep 8, 2019 at 9:58 AM William Dunlap wrote:
> Look at section 6.1 of the R Installation and Admin manual.
>
> 6.1 Default packages
>
> The set of packages loaded on startu
We noticed that the slot<- function alters its first argument, which goes
against the grain of a functional language. The similar @<- does not
change its first argument. Is this intended? The timeSeries and distr
package depend on this altering.
> setClass("Z", rep=representation(x="character")
> the perils certainly are not immediately apparent to me.
Here is a concrete example of a peril
`[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
length(cols) == 1)
{
SaveAt <- lapply(x, attributes)
x <- NextMethod()
lX <- lapply(names(x),function(nm, x, S
While developing a package, I often run install.packages() on it many times
in a session without updating its version number. How would your proposed
change affect this workflow?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Nov 8, 2019 at 11:56 AM Joshua Bradley wrote:
> I could do thi
Suppose update.packages("pkg") installed "pkg" if it were not already
installed, in addition to its current behavior of installing "pkg" if "pkg"
is installed but a newer version is available. The OP could then use
update.packages() all the time instead of install.packages() the first time
and upd
In general R doesn't print the "comment" attribute of an object
> structure(1:3, comment=c("a comment", "another comment"))
[1] 1 2 3
but if the object is a call it prints it in an unusual format
> structure(quote(func(arg)), comment=c("a comment", "another comment"))
a comment
anoth
2019 5:01 p.m., William Dunlap via R-devel wrote:
> > In general R doesn't print the "comment" attribute of an object
> > > structure(1:3, comment=c("a comment", "another comment"))
> > [1] 1 2 3
> > but if the object is
arrays and matrices have a numeric dims attribute, vectors don't. If
statements lead to bad code.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Nov 15, 2019 at 1:19 PM Abby Spurdle wrote:
> > > And indeed I think you are right on spot and this would mean
> > > that indeed the implicit
You may be running out of file descriptors because the pipe objects are not
getting garbage collected often enough. Adding the line
if (cnt %% 100 == 0) { cat(cnt, "\n"); gc() }
to your loop lets it continue indefinitely.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 6, 2019 at 4
You might expand the scope of this a bit to include Windows usernames with
non-ASCII characters in them. If I recall correctly, if you are logged
under a Cyrillic UTF-8 name then R will not even start. We have seen this
in the wild.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Dec 13,
How far would you like to go with the automatic creation of dimnames in
nested replacement operations on arrays? It currently works nicely with [<-
> a <- array(numeric(), dim=c(2,0,1)); dimnames(a)[3] <- list("One")
> str(a)
num[1:2, 0 , 1]
- attr(*, "dimnames")=List of 3
..$ :
If we change the behavior NULL--[[--assignment from
`[[<-`(NULL, 1, "a" ) # gives "a" (*not* a list)
to
`[[<-`(NULL, 1, "a" ) # gives list("a")
then we have more consistency there *and* your bug is fixed too.
Of course, in other situations back-compatibility would be
brok
tibco.com
On Sat, Feb 22, 2020 at 12:44 PM Martin Maechler
wrote:
> >>>>> Martin Maechler
> >>>>> on Sat, 22 Feb 2020 20:20:49 +0100 writes:
>
> >>>>> William Dunlap
> >>>>> on Fri, 21 Feb 2020 14
Note that substitute(...()) and substitute(someFunc(...))[-1] give slightly
different results, the former a pairlist and the latter a call.
> str((function(...)substitute(...()))(stop(1),stop(2),stop(3)))
Dotted pair list of 3
$ : language stop(1)
$ : language stop(2)
$ : language stop
Re the trailing path separator - should file.path() be changed to not
produce doubled path separators when an argument has a trailing path
separator?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Mar 23, 2020 at 9:24 AM Tomas Kalibera
wrote:
>
> Hi Jiefei,
>
> the change in handling tra
The use of the term 'vector' in R comes from S, where it was used, starting
in the latter part of the 1970s, to refer to the most primitive
(irreducible) parts of an object. It has little to do with the
mathematical or physical concept of a vector and, in my opinion, should not
be used much by ord
Using => and <= instead of -> and <- would make things easier, although the
precedence would be different.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Mon, Apr 13, 2020 at 1:43 AM Adrian Dușa wrote:
> Thank you for your replies, this actually has little to do with the
> regular R code but
arser, while "<=" is
> not because it denotes less than or equal.
>
> Now, if I could find a way to define "=>" as a standalone operator, and
> convince the R parser to bypass that error, it would solve everything. If
> this is not possible, I am back to detecti
301 - 400 of 499 matches
Mail list logo