Displaying 20 results from an estimated 3000 matches similar to: "tapply on empty data.frames (PR#10644)"
2007 Jun 05
4
Refactor all factors in a data frame
Hi all,
Assume I have a data frame with numerical and factor variables that I
got through merging various other data frames and subsetting the
resulting data frame afterwards. The number levels of the factors seem
to be the same as in the original data frames, probably because subset()
calls [.factor without drop = TRUE (that's what I gather from scanning
the mailing lists).
I wonder if
2010 May 19
3
Strange case of partial matching in .[ - possible bug / wrong documentation?
Hi all,
This occurred in R-2.11.0 (WinXP).
The R-help page of .[ says that:
"Character indices can in some circumstances be partially matched (see
pmatch) to the names or dimnames of the object being subsetted (but never
for subassignment). Unlike S (Becker et al p. 358)), R has never used
partial matching when extracting by [, and as from R 2.7.0 partial matching
is not by default used by
2008 Jan 02
2
strange behavior of cor() with pairwise.complete.obs
Hi all,
I'm not quite sure if this is a feature or a bug or if I just fail to understand
the documentation:
If I use cor() with pairwise.complete.obs and method=pearson, the result is a
scalar:
->cor(c(1,2,3),c(3,4,6),use="pairwise.complete.obs",method="pearson")
[1] 0.9819805
The documentation says that
" '"pairwise.complete.obs"' only
2017 Jan 26
3
RFC: tapply(*, ..., init.value = NA)
Last week, we've talked here about "xtabs(), factors and NAs",
-> https://stat.ethz.ch/pipermail/r-devel/2017-January/073621.html
In the mean time, I've spent several hours on the issue
and also committed changes to R-devel "in two iterations".
In the case there is a *Left* hand side part to xtabs() formula,
see the help page example using 'esoph',
it
2017 Jan 26
2
RFC: tapply(*, ..., init.value = NA)
On a related note, the storage mode should try to match ans[[1]] (or
unlist:ed and) when allocating 'ansmat' to avoid coercion and hence a full
copy.
Henrik
On Jan 26, 2017 07:50, "William Dunlap via R-devel" <r-devel at r-project.org>
wrote:
It would be cool if the default for tapply's init.value could be
FUN(X[0]), so it would be 0 for FUN=sum or FUN=length, TRUE
1997 Dec 08
3
R-alpha: Bug in tapply in the Windows version of September
The function tapply is not working in the Windows version of R=20
(Version 0.50 Beta (Sept 29, 1997))
In
tapply <- function (x, INDEX, FUN=3DNULL, simplify=3DTRUE, ...)=20
...
The part:
if (simplify && all(unlist(lapply(ans, length)) =3D=3D 1)) {
ans <- unlist(ans, recursive =3D FALSE)
names(ans)<-namelist[[1]]
return(ans)
}
should be replaced by
if (simplify
2019 Sep 11
2
'==' operator: inconsistency in data.frame(...) == NULL
Sorry, I can't reproduce the example below even on the same machine.
However, the following example produces the same error as NULL values in
prior examples:
> setClass("FOOCLASS",
+????????? representation("list")
+ )
> ma = new("FOOCLASS", list(M=matrix(rnorm(300), 30,10)))
> isS4(ma)
[1] TRUE
> data.frame(a=1:3) == ma
Error in
2017 Apr 24
2
Crash after (wrongly) applying product operator on object from LIMMA package
Hi Hilmar,
weird. The memory problem seems be due to recursion (my R, version 3.3.3,
says: Error: evaluation nested too deeply: infinite recursion /
options(expressions=)?, just write traceback() to see how it happens), but
why does it segfault with xlsx? Nb xlsx is the culprit: neither rJava nor
xlsxjars cause the problem.
On the other hand, quick googling for r+xlsx+segfault returns tons of
2018 Oct 05
2
Seg fault stats::runmed
Dear all,
I just found this issue:
dd1 = c(rep(NaN,82), rep(-1, 144), rep(1, 74))
xx = runmed(dd1, 21)
-> R crashes reproducibly in R 3.4.3, R3.4.4 (Ubuntu 14.04/Ubuntu 16.04)
With GDB:
Program received signal SIGSEGV, Segmentation fault.
swap (l=53, r=86, window=window at entry=0xc59308,
outlist=outlist at entry=0x12ea2e8, nrlist=nrlist at entry=0x114fdd8,
print_level=print_level at
2017 Apr 19
2
Crash after (wrongly) applying product operator on S4 object that derives from list
Dear Hilmar
Perhaps this gives an indication of why the infinite recursion happens:
## after calling `*` on ma and a matrix:
> showMethods(classes=class(ma), includeDefs=TRUE, inherited = TRUE)
Function: * (package base)
e1="FOOCLASS", e2="matrix"
(inherited from: e1="vector", e2="structure")
(definition from function "Ops")
2019 Sep 11
2
'==' operator: inconsistency in data.frame(...) == NULL
Dear Martin,
On 11/09/2019 09:56, Martin Maechler wrote:
>
> > I wonder if data.frame(<some non-empty data>) == NULL should also return
> > a value instead of an error. R help reads:
>
> > "At least one of |x| and |y| must be an atomic vector, but
> > if the other is a list R attempts to coerce it to the
> > type of the atomic
2017 Jan 27
1
RFC: tapply(*, ..., init.value = NA)
The "no factor combination" case is distinguishable by 'tapply' with simplify=FALSE.
> D2 <- data.frame(n = gl(3,4), L = gl(6,2, labels=LETTERS[1:6]), N=3)
> D2 <- D2[-c(1,5), ]
> DN <- D2; DN[1,"N"] <- NA
> with(DN, tapply(N, list(n,L), FUN=sum, simplify=FALSE))
A B C D E F
1 NA 6 NULL NULL NULL NULL
2 NULL NULL 3 6
2024 Jul 16
1
I() in merge (was: Re: xftrm is more than 100x slower for AsIs than for character vectors)
Dear all,
actually, it is not clear to me why there is still a protection of the
added Row.names column in merge using I(). This seems to stem from a
time when R would automatically convert character vectors to factor in
data.frame on insert. However, I can't reproduce this behaviour even in
data.frames generated with stringsAsFactors = T in current versions of
R. Maybe the I() inserted in r
2017 Jan 27
1
RFC: tapply(*, ..., init.value = NA)
On Fri, Jan 27, 2017 at 12:34 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>
> > On Jan 26, 2017 07:50, "William Dunlap via R-devel" <r-devel at r-project.org>
> > wrote:
>
> > It would be cool if the default for tapply's init.value could be
> > FUN(X[0]), so it would be 0 for FUN=sum or FUN=length, TRUE for
>
2017 Apr 18
3
Crash after (wrongly) applying product operator on object from LIMMA package
Hi,
this is a problem that occurs in the presence of two libraries (limma,
xlsx) and leads to a crash of R. The problematic code is the wrong
application of sweep or the product ("*") function on an LIMMA MAList
object. To my knowledge, limma does not define a "*" method for MAList
objects.
If only LIMMA is loaded but not package xlsx, the code does not crash
but rather
2017 May 09
3
A few suggestions and perspectives from a PhD student
Hi,
On 08/05/17 16:37, Ista Zahn wrote:
> One of the key strengths of R is that packages are not akin to "fan
> created mods". They are a central and necessary part of the R system.
>
I would tend to disagree here. R packages are in their majority not
maintained by the core R developers. Concepts, features and lifetime
depend mainly on the maintainers of the package (even
2019 Sep 24
1
'==' operator: inconsistency in data.frame(...) == NULL
Dear Martin,
thanks a lot for looking into this. Of course you were right that the
fix was not complete - I apologize for not having tested what I believed
to be the solution.
My comments on the S4 classes seemed to stem from a misunderstanding on
my side. I now believe to understand that S4 classes that inherit from R
base object types might dispatch Ops for the same object types.
If the
2006 Jan 17
1
Font size of axis labels
Hi all,
In R, it is not possible to set the font size of axis labels directly
(AFAIK). Instead, scaling factors for the font chosen by the graphics
device can be supplied. It appears that there is no constant font size
for axis labels. My impression is that the axis label font size is
scaled internally by R depending on the number of labels given for an axis.
In addition to the R-internal
2010 Oct 28
1
Unexpected behabiour of min, tapply and POSIXct/POSIXlt classes?
Hello,
I found rather surprising the behaviour of POSIXct and POSIXlt classes
when combined with min and tapply.
The details can be deduced from the script below:
############# Start of the script ####################
before <- Sys.time()
Sys.sleep( 1 )
now1 <- now2 <- Sys.time()
my.times <- c( before, now1, now2 )
class( my.times ) ## [1] "POSIXct"
2024 Jul 14
1
xftrm is more than 100x slower for AsIs than for character vectors
Dear Ivan,
thanks for the confirmation and the proposed patch.
I just wanted to add some notes regarding the relevance of this: base::merge using by.x=0 or by.y=0 (i.e. matching on row.names) will automatically add a column Row.names which is I(row.names(x)) to the corresponding input table (using I() since revision 39026 to avoid conversion of character to factor). When this column is used