Displaying 20 results from an estimated 10000 matches similar to: "'max' on mixed numeric and character arguments"
2012 Dec 06
2
factor(x, exclude=y) if x is a factor
I found this part in the documentation of 'factor'.
'factor(x, exclude=NULL)' applied to a factor is a no-operation
unless there are unused levels: in that case, a factor with the
reduced level set is returned. If 'exclude' is used it should
also be a factor with the same level set as 'x' or a set of codes
for the levels to be excluded.
2010 Jul 08
2
strsplit("dia ma", "\\b") splits characterwise
\b is word boundary.
But, unexpectedly, strsplit("dia ma", "\\b") splits character by character.
> strsplit("dia ma", "\\b")
[[1]]
[1] "d" "i" "a" " " "m" "a"
> strsplit("dia ma", "\\b", perl=TRUE)
[[1]]
[1] "d" "i" "a" " "
2013 Jan 28
1
Suggestions for 'diff.default'
I have suggestions for function 'diff.default' in R.
Suggestion 1: If the input is matrix, always return matrix, even if empty.
What happens in R 2.15.2:
> rbind(1:2) # matrix
[,1] [,2]
[1,] 1 2
> diff(rbind(1:2)) # not matrix
integer(0)
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United
2017 Aug 19
1
Issues of R_pretty in src/appl/pretty.c
Yes, they work now.
I mentioned them partly because the commit description said overflow for large n and partly to be considered for regression tests.
--------------------------------------------
On Sat, 19/8/17, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] Issues of R_pretty in src/appl/pretty.c
Cc: r-devel at r-project.org
Date: Saturday, 19 August, 2017,
2013 Feb 01
1
Was confused with options(error = expression(NULL)) in example(stop)
In example for function 'stop' in R, there is
options(error = expression(NULL))
with comment
# don't stop on stop(.) << Use with CARE! >>
I was interested, wanted to know how "don't stop on stop(.)" was. So, I tried it.
Typing
example(stop)
at the R prompt and pressing ENTER give this.
> example(stop)
stop> options(error = expression(NULL))
2018 Apr 29
1
Result of 'seq' doesn't use compact internal representation
Thanks -- I'll commit a fix after some testing.
Best,
luke
On 04/29/2018 06:22 AM, Duncan Murdoch wrote:
> On 28/04/2018 11:11 PM, Suharto Anggono Suharto Anggono via R-devel wrote:
>>> .Internal(inspect(1:10))
>> @300e4e8 13 INTSXP g0c0 [NAM(3)]? 1 : 10 (compact)
>>> .Internal(inspect(seq(1,10)))
>> @3b6e1f8 13 INTSXP g0c4 [] (len=10, tl=0) 1,2,3,4,5,...
2018 Apr 29
2
Result of 'seq' doesn't use compact internal representation
> .Internal(inspect(1:10))
@300e4e8 13 INTSXP g0c0 [NAM(3)] 1 : 10 (compact)
> .Internal(inspect(seq(1,10)))
@3b6e1f8 13 INTSXP g0c4 [] (len=10, tl=0) 1,2,3,4,5,...
> system.time(1:1e7)
user system elapsed
0 0 0
> system.time(seq(1,1e7))
user system elapsed
0.05 0.00 0.04
It seems that result of function 'seq' doesn't use compact
2018 Apr 29
0
Result of 'seq' doesn't use compact internal representation
On 28/04/2018 11:11 PM, Suharto Anggono Suharto Anggono via R-devel wrote:
>> .Internal(inspect(1:10))
> @300e4e8 13 INTSXP g0c0 [NAM(3)] 1 : 10 (compact)
>> .Internal(inspect(seq(1,10)))
> @3b6e1f8 13 INTSXP g0c4 [] (len=10, tl=0) 1,2,3,4,5,...
>> system.time(1:1e7)
> user system elapsed
> 0 0 0
>> system.time(seq(1,1e7))
> user
2016 May 30
1
factor(x, exclude=NULL) for factor x; names in as.factor(<integer>)
In R 3.3.0 (also in R 2.7.2), the documentation on 'factor', in "Details" section, has this statement.
'factor(x, exclude = NULL)' applied to a factor is a no-operation unless there are unused levels: in that case, a factor with the reduced level set is returned.
It is not true for a factor 'x' that has NA. In that case, if levels of 'x' doesn't
2016 Jan 03
1
Wrong bug ID & URL in Daily News about R-devel/NEWS
I was browsing some recent R news at
http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2016/01/03#n2016-01-03
And reading this item:
"tapply() has been made considerably more efficient without changing
functionality, thanks to proposals from Peter Haverty and Suharto
Anggono. (PR#16488)"
But I found that the link in the item goes to a page about the GUI, not
tapply:
2013 Apr 30
3
Subset of a 'table' divided by a 'table' is a 'table', but printed by 'print.default'
This is just info.
I recently got something like this.
> x <- factor(c("A","A","B","B"), levels=c("A","B"))
> y <- factor(c("a","b","a","b"), levels=c("a","b"))
> table(x, y)[, "a"] / table(x)
x
A B
0.5 0.5
attr(,"class")
[1]
2012 Sep 03
1
Typo (?) in 'aggregate.formula'
In the code for 'aggregate.formula', there is
if (as.character(formula[[2L]] == "."))
I believe that it is meant to be
if (as.character(formula[[2L]]) == ".")
However,
if (as.character(formula[[2L]] == "."))
gives the expected result.
Tracing:
- formula[[2L]] == "."
is equivalent to
as.character(formula[[2L]]) == "."
From the help page for
2017 Aug 18
1
Issues of R_pretty in src/appl/pretty.c
Examples similar to
pretty(c(-1,1)*1e300, n = 1e9, min.n = 1)
with smaller 'n':
pretty(c(-1,1)*1e304, n = 1e5, min.n = 1)
pretty(c(-1,1)*1e306, n = 1e3, min.n = 1)
A report on 'pretty' when working with integers, similar to what led to change of 'seq' fuzz, is https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15137
--------------------------------------------
On Tue,
2017 Feb 26
1
rep/rep.int: in NEWS, but not yet ported from trunk
According to "CHANGES IN R 3.3.2 patched" in NEWS, rep(x, times) and rep.int(x, times) also work when 'times' has length greater than one and has element larger than the maximal integer. In fact, it is still not the case in R 3.3.3 beta r72259. In seq.c (https://svn.r-project.org/R/branches/R-3-3-branch/src/main/seq.c), 'times' that is a vector with storage mode
2013 Oct 02
0
For numeric x, as.character(x) doesn't always match signif(x, 15)
I saw something like this.
> x <- 5180000000000003
> print(x, digits=20)
[1] 5180000000000003
> as.character(x)
[1] "5.18e+15"
I thought it was because, when x is numeric, as.character(x) represents x rounded to 15 significant digits.
> print(signif(x, 15), digits=20)
[1] 5180000000000000.0000
> as.numeric(as.character(x)) == signif(x, 15)
[1] TRUE
The documentation
2009 Oct 29
0
In the result of applying 'bquote' to function definition with 2 or more arguments, first function argument disappears (PR#14031)
Full_Name: Suharto Anggono
Version: 2.8.1
OS: Windows
Submission from: (NULL) (125.165.81.124)
Sorry for repost. There is already PR#9602, but the problem is still there.
There is also a post "Re: [R] using bquote to construct function" in R-help
2008-10-02.
This illustrates the problem.
C:\Program Files\R\R-2.8.1\bin>R --vanilla
R version 2.8.1 (2008-12-22)
Copyright (C) 2008
2016 Aug 14
2
table(exclude = NULL) always includes NA
useNA <- if (missing(useNA) && !missing(exclude) && !(NA %in% exclude)) "ifany"
An example where it change 'table' result for non-factor input, from https://stat.ethz.ch/pipermail/r-help/2005-April/069053.html :
x <- c(1,2,3,3,NA)
table(as.integer(x), exclude=NaN)
I bring the example up, in case that the change in result is not intended.
2017 Oct 05
0
socketSelect(..., timeout): non-integer timeouts in (0, 2) (?) equal infinite timeout on Linux - weird
I'd like to follow up/bump the attention to this bug causing the
timeout to fail for socketSelect() on Unix. It is still there in R
3.4.2 and R-devel. I've identified the bug in the R source code - the
bug is due to floating-point precisions and comparison using >=. See
PR17203 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17203)
for details and a patch. I've just
2016 Sep 26
2
Undocumented 'use.names' argument to c()
By "an argument named 'use.names' is included for concatenation", I meant something like this, that someone might try.
> c(as.Date("2016-01-01"), use.names=FALSE)
use.names
"2016-01-01" "1970-01-01"
See, 'use.names' is in the output. That's precisely because 'c.Date' doesn't have 'use.names', so
2017 Feb 27
0
rep/rep.int: in NEWS, but not yet ported from trunk
For R 3.3.3, if 3.3.3 is really the last in 3.3.x series, I suggest reverting to R 3.3.2 code (and removing the corresponding NEWS entry), if possible. Failure of something like
rep(5, list(6))
makes some previously working R code broken in some situation. It is not good to have in an R release that will last long, I think.
--------------------------------------------
On Mon, 27/2/17, Martin