Displaying 20 results from an estimated 30000 matches similar to: "Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)"
2016 Aug 27
2
'droplevels' inappropriate change
In R devel r71157, 'droplevels' documentation, in "Arguments" section, says this about argument 'exclude'.
passed to factor(); factor levels which should be excluded from the result even if present. Note that this was implicitly NA in R <= 3.3.1 which did drop NA levels even when present in x, contrary to the documentation. The current default is compatible with x[ ,
2016 Sep 13
0
Coercion of 'exclude' in function 'factor' (was 'droplevels' inappropriate change)
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org>
>>>>> on Fri, 2 Sep 2016 16:10:00 +0000 writes:
> I am basically fine with the change.
> How about using just the following?
> if(!is.character(exclude))
> exclude <- as.vector(exclude, typeof(x)) # may result in NA
> x <- as.character(x)
2016 Aug 21
1
'droplevels' inappropriate change
In R devel r71124, if 'x' is a factor, droplevels(x) gives
factor(x, exclude = NULL) .
In R 3.3.1, it gives
factor(x) .
If a factor 'x' has NA and levels of 'x' doesn't contain NA, factor(x) gives the expected result for droplevels(x) , but factor(x, exclude = NULL) doesn't. As I said in https://stat.ethz.ch/pipermail/r-devel/2016-May/072796.html , factor(x,
2017 Jun 06
1
[bug] droplevels() also drop object attributes (comment…)
>>>>> Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Tue, 16 May 2017 11:01:23 +0200 writes:
>>>>> Serge Bibauw <sbibauw at gmail.com>
>>>>> on Mon, 15 May 2017 11:59:32 -0400 writes:
>> Hi,
>> Just reporting a small bug? not really a big deal, but I
>> don?t think that is
2016 Aug 27
0
'droplevels' inappropriate change
>>>>> Suharto Anggono Suharto Anggono via R-devel <r-devel at r-project.org>
>>>>> on Sat, 27 Aug 2016 03:17:32 +0000 writes:
> In R devel r71157, 'droplevels' documentation, in "Arguments" section, says this about argument 'exclude'.
> passed to factor(); factor levels which should be excluded from the result even if
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.
2017 Jun 14
1
[bug] droplevels() also drop object attributes (comment…)
In R devel r72789, the added part in 'factor' documentation (factor.Rd) is the following.
Undocumentedly for a long time, \code{factor(x)} loses all \code{\link{attributes}(x)} but \code{"names"}, and resets \code{"levels"} and \code{"class"}.
In the code of function 'factor', names(x) is copied to the result. As I mentioned before, names(x) is _not_
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.
2016 Aug 17
1
table(exclude = NULL) always includes NA
The quirk as in table(1:3, exclude = 1, useNA = "ifany") is actually somewhat documented, and still in R devel r71104. In R help on 'table', in "Details" section:
It is best to supply factors rather than rely on coercion. In particular, ?exclude? will be used in coercion to a factor, and so values (not levels) which appear in ?exclude? before coercion will be mapped to
2016 Aug 15
1
table(exclude = NULL) always includes NA
>>>>> Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Mon, 15 Aug 2016 11:07:43 +0200 writes:
>>>>> Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com>
>>>>> on Sun, 14 Aug 2016 03:42:08 +0000 writes:
>> useNA <- if (missing(useNA) && !missing(exclude) && !(NA %in%
2018 Mar 17
1
Inappropriate parens fix for Logic.Rd
Logic.Rd has been changed again in r74377. After change:
? \item{x, y}{raw or logical or \sQuote{number-like} vectors (i.e., of
? ? types \code{\link{double}} (class \code{\link{numeric}},
? ? \code{\link{integer}}) and \code{\link{complex}}), or objects for
It is still inappropriate. As I said before, integer is not double.
Right: numeric includes double and integer
Wrong: double includes
2016 Aug 11
2
table(exclude = NULL) always includes NA
I stand corrected. The part "If set to 'NULL', it implies 'useNA="always"'." is even in the documentation in R 2.8.0. It was my fault not to check carefully.
I wonder, why "always" was chosen for 'useNA' for exclude = NULL.
Why exclude = NULL is so special? What about another 'exclude' of length zero, like character(0) (not c(),
2019 Nov 18
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
>>>>> Martin Maechler
>>>>> on Mon, 18 Nov 2019 12:15:38 +0100 writes:
>>>>> suharto anggono--- via R-devel
>>>>> on Sun, 17 Nov 2019 10:34:31 +0000 writes:
>> SVN revision 77401 changes
>> x[isM] <- lapply(x[isM], function(o) `class<-`(o, class(o)[class(o) != "AsIs"]))
>> to
2016 Sep 10
1
table(exclude = NULL) always includes NA
Looking at the code of function 'table' in R devel r71227, I see that the part "remove NA level if it was added only for excluded in factor(a, exclude=.)" is not quite right.
In
is.na(a) <- match(a0, c(exclude,NA), nomatch=0L) ,
I think that what is intended is
a[a0 %in% c(exclude,NA)] <- NA .
So, it should be
is.na(a) <- match(a0, c(exclude,NA),
2018 Mar 24
1
Function 'factor' issues
I am trying once again.
By just changing
f <- match(xlevs[f], nlevs)
to
f <- match(xlevs, nlevs)[f]
, function 'factor' in R devel could be made more consistent and back-compatible. Why not picking it?
--------------------------------------------
On Sat, 25/11/17, Suharto Anggono Suharto Anggono <suharto_anggono at yahoo.com> wrote:
Subject: Re: [Rd] Function
2016 Aug 07
2
table(exclude = NULL) always includes NA
This is an example from https://stat.ethz.ch/pipermail/r-help/2007-May/132573.html .
With R 2.7.2:
> a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1)
> table(a, b, exclude = NULL)
b
a 1 2
1 1 1
2 2 0
3 1 0
<NA> 1 0
With R 3.3.1:
> a <- c(1, 1, 2, 2, NA, 3); b <- c(2, 1, 1, 1, 1, 1)
> table(a, b, exclude = NULL)
b
a 1 2
2017 Feb 01
1
RFC: tapply(*, ..., init.value = NA)
On 'aggregate data.frame', the URL should be https://stat.ethz.ch/pipermail/r-help/2016-May/438631.html .
vector(typeof(ans))
(or vector(storage.mode(ans)))
has length zero and can be used to initialize array.
Instead of
if(missing(default)) ,
if(identical(default, NA))
could be used. The documentation could then say, for example: "If default = NA (the default), NA of appropriate
2019 Nov 17
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
SVN?revision?77401?changes
????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[class(o)?!=?"AsIs"]))
to
????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[!inherits(o,"AsIs")]))
in?function?'get_all_vars'?in?src/library/stats/R/models.R?in?R?devel.
The?change?is?inappropriate.
2017 Nov 04
1
ans[nas] <- NA in 'ifelse' (was: ifelse() woes ... can we agree on a ifelse2() ?)
Removal of
ans[nas] <- NA
from the code of function 'ifelse' in R is not committed (yet). Why?
--------------------------------------------
On Mon, 28/11/16, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
Subject: Re: [Rd] ifelse() woes ... can we agree on a ifelse2() ?
Cc: R-devel at r-project.org, maechler at stat.math.ethz.ch
Date: Monday, 28 November, 2016, 10:00
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