Displaying 20 results from an estimated 700 matches similar to: "A patch for do_sample: check replace arg"
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
I'd like to propose that the whenever the length of condition passed
to an if or a while statement differs from one, an error is produced
rather than just a warning as today:
> x <- 1:2
> if (x == 1) message("x == 1")
x == 1
Warning message:
In if (x == 1) message("x == 1") :
the condition has length > 1 and only the first element will be used
There are
2009 Mar 29
2
if does not covert raw to logical (PR#13630)
Full_Name: Wacek Kusnierczyk
Version: 2.8.0 and 2.10.0 r48242
OS: Ubuntu 8.04 Linux 32 bit
Submission from: (NULL) (80.202.30.36)
The following raises an error:
if (as.raw(1)) 1
# error: unimplemented type 'raw' in 'asLogical'
However, ?'if' says:
"
Arguments:
cond: A length-one logical vector that is not 'NA'. Conditions of
length
2010 Jun 19
1
more powerful iconv
R community,
As you may know, R's iconv doesn't work well converting to and from
encodings that allow embedded nulls. For example
> iconv("foo", to="UTF-16")
Error in iconv("foo", to = "UTF-16") :
embedded nul in string: '\xff\xfef\0o\0o\0'
However, I don't believe embedded nulls are at issue here, but rather
that R's iconv
2009 Jan 19
1
patch for textspecial and defaultfont in xfig
Hello,
The current xfig device lacks the functionality to set the
textspecial flag and use the defaultfont in xfig. This is necessary
when you want to export to xfig and use interpreted text (e.g., $
\frac{1}{e}$ gets interpreted by latex). The attached patch adds this
functionality.
Why would you like to do this?
- Use math in labels (e.g., name your variables $r_{xy}$, do a
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 03
0
Control statements with condition with greater than one should give error (not just warning) [PATCH]
>>>>> Henrik Bengtsson <henrik.bengtsson at gmail.com>
>>>>> on Fri, 3 Mar 2017 00:52:16 -0800 writes:
> I'd like to propose that the whenever the length of condition passed
> to an if or a while statement differs from one, an error is produced
> rather than just a warning as today:
>> x <- 1:2
>> if (x == 1)
2019 May 01
3
anyNA() performance on vectors of POSIXct
Inside of the anyNA() function, it will use the legacy any(is.na()) code if
x is an OBJECT(). If x is a vector of POSIXct, it will be an OBJECT(), but
it is also TYPEOF(x) == REALSXP. Therefore, it will skip the faster
ITERATE_BY_REGION, which is typically 5x faster in my testing.
Is the OBJECT() condition really necessary, or could it be moved after the
switch() for the individual TYPEOF(x)
2010 Sep 08
0
Correction to vec-subset speed patch
I found a bug in one of the fourteen speed patches I posted, namely in
patch-vec-subset. I've fixed this (I now see one does need to
duplicate index vectors sometimes, though one can avoid it most of the
time). I also split this patch in two, since it really has two
different and independent parts. The patch-vec-subset patch now has
only some straightforward (locally-checkable) speedups for
Control statements with condition with greater than one should give error (not just warning) [PATCH]
2017 Mar 03
2
Control statements with condition with greater than one should give error (not just warning) [PATCH]
On Fri, Mar 3, 2017 at 9:22 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Henrik Bengtsson <henrik.bengtsson at gmail.com>
>>>>>> on Fri, 3 Mar 2017 00:52:16 -0800 writes:
>
> > I'd like to propose that the whenever the length of condition passed
> > to an if or a while statement differs from one, an
2000 Feb 07
1
small bug in plot code
I get a segfault from:
R> plot( x, y, log="does this work?" )
[telford@faraday ring-core]$ R --version
Version 0.64.2 (July 3, 1999)
Copyright (C) 1999 R Development Core Team
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License. For more information about
these matters, see
2024 Apr 10
1
Problem with base::order
? Wed, 10 Apr 2024 09:33:19 +0200
Sigbert Klinke <sigbert at wiwi.hu-berlin.de> ?????:
> decreasing=c(F,F,F)
This is only documented to work with method = 'radix':
>> For the ?"radix"? method, this can be a vector of length equal to
>> the number of arguments in ?...? and the elements are recycled as
>> necessary. For the other methods, it must be
2023 Apr 16
1
Unique ID for conditions to supress/rethrow selected conditions?
On Sun, 2023-04-16 at 13:52 +0200, I?aki Ucar wrote:
> I agree that something like this would be a nice addition. With the
> current condition system, it would be certainly easy (but quite a lot
> of work) to define a hierarchy of built-in conditions, and then use
> them consistently throughout base R.
Yes, a typed condition system would be great.
I have two other ideas:
By
2015 Jun 01
2
sum(..., na.rm=FALSE): Summing over NA_real_ values much more expensive than non-NAs for na.rm=FALSE? Hmm...
I'm observing that base::sum(x, na.rm=FALSE) for typeof(x) == "double"
is much more time consuming when there are missing values versus when
there are not. I'm observing this on both Window and Linux, but it's
quite surprising to me. Currently, my main suspect is settings in on
how R was built. The second suspect is my brain. I hope that someone
can clarify the below
2007 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <-
2018 Dec 04
3
patch to support custom HTTP headers in download.file() and url()
The patch below adds support for custom HTTP headers in
download.file() and url().
My main motivation for this is performing basic http authentication.
Some web sites do not support embedding the credentials into the URI
itself, they only work if the username and password are sent in the
HTTP headers. In fact specifying the username and password in the URI
has been
2019 Apr 05
2
patch to improve matrix conformability error message
With this patch,
> A <- matrix(1, 2, 2)
> B <- matrix(2, 3, 2)
> A %*% B
Error in A %*% B :
non-conformable arguments of dimension (2, 2) and (3, 2)
>From 205b591d4d14b5ff667325fb233a6deb08314726 Mon Sep 17 00:00:00 2001
From: Joshua Nathaniel Pritikin <jpritikin at pobox.com>
Date: Fri, 5 Apr 2019 12:03:58 -0400
Subject: [PATCH] Improve non-conformable arguments error
2011 Aug 14
0
Improved version of Rprofmem
The Rprofmem facility is currently enabled only if the configuration
option --enable-memory-profiling is used. However, the overhead of
having it enabled is negligible when profiling is not actually being
done, and can easily be made even smaller. So I think it ought to be
enabled all the time.
I've attached a patch doing this, which also makes a number of other
improvements to Rprofmem,
2006 Sep 08
1
R drop behavior -- set as option in later version?
Hi,
I know the topic of drop=TRUE/FALSE has been discussed quite a bit, but
I was wondering whether it might be possible to set "drop=FALSE" as a
global setting (e.g. as an option in options()) so that one does not
have to remember
to write it every time you do an operation which might return a 1
column or 1 row matrix.
I searched in R-help and did not see any previous proposals along
2006 Sep 08
1
R drop behavior -- set as option in later version?
Hi,
I know the topic of drop=TRUE/FALSE has been discussed quite a bit, but
I was wondering whether it might be possible to set "drop=FALSE" as a
global setting (e.g. as an option in options()) so that one does not
have to remember
to write it every time you do an operation which might return a 1
column or 1 row matrix.
I searched in R-help and did not see any previous proposals along
2006 Nov 21
2
packBits (PR#9374)
Full_Name: Prokaj Vilmos
Version: R 2-4-0
OS: Windows
Submission from: (NULL) (193.224.79.8)
PackBits(rbinom(32,1,0.5)==1,"integer")
does not work.
z<-packBits(rbinom(32,1,.5)==1,"integer")
Error in packBits(x, type) : argument 'x' must be raw, integer or logical
Taking a closer look at the C code
main/character.c do_packBits rutin
one can find the following
2011 Oct 05
1
Moderating consequences of garbage collection when in C
Allocating many small objects triggers numerous garbage collections as R
grows its memory, seriously degrading performance. The specific use case
is in creating a STRSXP of several 1,000,000's of elements of 60-100
characters each; a simplified illustration understating the effects
(because there is initially little to garbage collect, in contrast to an
R session with several packages