Displaying 20 results from an estimated 800 matches similar to: "R-alpha: Bug in tapply in the Windows version of September"
2008 Apr 15
1
by inconsistently strips class - with fix
summary:
The function 'by' inconsistently strips class from the data to which
it is applied.
quick reason:
tapply strips class when simplify is set to TRUE (the default) due to
the class stripping behaviour of unlist.
quick answer:
This can be fixed by invoking tapply with simplify=FALSE, or changing
tapply to use do.call(c instead of unlist
executable example:
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
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
2001 Nov 29
0
a patch to tapply (PR#1186)
Though tapply(x, factor, fun, simplify =TRUE) should be equivalent to
sapply(split(x, factor), fun, simplify=TRUE), note simplify=TRUE, it is not
so if fun() returns a vector rather than a scalar, e.g.
> tapply(1:6, c(0,0,0,1,1,1), function(x) c(min=min(x), max=max(x)),
simplify=TRUE)
$"0"
min max
1 3
$"1"
min max
4 6
> sapply(split(1:6, c(0,0,0,1,1,1)),
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
>
1997 Aug 19
2
R-alpha: A few bugs in R-0.50-a3.
A few problems in R-0.50-a3 (which were also in R-0.49):
1)
y <- c(10,11,12,13,14,NA,NA)
n <- length(y)
missed <- (1:n)[is.na(y)]
notmissed <- (1:n)[!is.na(y)]
blocks <- cut(missed,breaks=c(0,notmissed,n+1))
a <- function(v) {
q <- range(v)
c(q[1]-1,q[2]+1)
}
brackets <- tapply(missed,blocks,a)
This codes gives the following in S:
> brackets
$"0+ thru 1":
2007 Nov 06
1
A suggestion for an amendment to tapply
Dear R-developers,
when tapply() is invoked on factors that have empty levels, it returns
NA. This behaviour is in accord with the tapply documentation, and is
reasonable in many cases. However, when FUN is sum, it would also
seem reasonable to return 0 instead of NA, because "the sum of an
empty set is zero, by definition."
I'd like to raise a discussion of the possibility of an
2008 Dec 16
2
Problem assigning "NA" as a level name in a list
I want to generate a list (called "dataList" below) where each of its
levels is named. These names are assigned to nameList, which contains
all possible permutations of size two taking letters from a larger
alphabet, e.g., "aa",...,"Fd",..,"Z1",... One of these permutations is
the character string "NA". It seems that when I try to name one
2005 Apr 16
2
String in data frame
hello,
how can take the string in the data frame.
right now i have a table that create as a data frame and stored in the file called "data.xls" and now i want to read data frame as a table in my another r program, i used the following command:
the first column of the data frame is just one number called "num", but the second one a list of string, called "name".
d
2017 Jan 25
3
Undefined behavior of head() and tail() with n = 0
Hi all,
The documentation for head() and tail() describes the behavior of
these generic functions when n is strictly positive (n > 0) and
strictly negative (n < 0). How these functions work when given a zero
value is not defined.
Both GNU command-line utilities head and tail behave differently with +0 and -0:
http://man7.org/linux/man-pages/man1/head.1.html
2011 Apr 21
1
problem subsetting of a reference class
I am trying to define subset operator for a reference class and hitting some
problem i am unable to diagnose.To give an example, here is a toy class
generator that is a wrapper around a list
tmpGEN<-setRefClass("TMP", fields=list(
namelist="list"
))
tmpGEN$methods('add'=function(obj, name){
namelist[[name]]<<-obj
})
2004 Jun 30
1
GLM problem
HI, I am a studient, so don't be surprise if my question seems so simple for you...
I have a dataframe with 6 qualitative variables divided in 33 modalities, 2 qualitatives variables and 78 lines. I use a glm to know wich variables have interactions... I would like to know if its normal that one (the first in alphabetical order) of the modalities of each qualitatives variable doesn't
2007 Jul 31
1
[Bridge] brctl uses incorrect sysfs path
Hi,
I noticed that brctl (or more accurately, libbridge) is using the wrong path
when doing various lookups in sysfs: e.g. /sys/class/net/brXXX/stp_state
when it should use /sys/class/net/brXXX/bridge/stp_state. This doesn't
cause any problems on most systems as it falls back to the ioctl when the
sysfs attempt fails; however the ioctl method is apparently deprecated. I
believe the
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
First, here's the problem I'm working on so you understand the context. I
have a data frame of travel activity characteristics with 70,000+ records.
These activities are identified by unique chain numbers. (Activities are
part of trip chains.) There are 17,500 chains.
I use the chain numbers as factors to split various data fields into lists
of chain characteristics with each element of
2017 Jun 13
2
reading data
Hi all,
I am using R to extract data on a regular basis.
However, sometimes using the same script and the same data I am
getting different observation.
The library I am using and how I am reading it is as follows.
library(stringr)
namelist <- file("Adress1.txt",encoding="ISO-8859-1")
Name <- read.fwf(namelist,
colClasses="character",
2005 Jan 10
2
doing many commands within R
Dear all,
I'm new to this list, so let me greet everyone.
My problem is that I have several thousand data files which I want to
perform a lot of R commands on, which are found in a seperate .R script.
Now, what I did was within the R prompt, I used to read in a list of the
data files.
e.g.
namelist <- readLines("list_of_names",n=-1)
for (i in 1:100) {
k <-
2014 Jun 24
1
Dsync replication one-way
Hi all,
I know that I can do a backup using doveadm:
doveadm backup -u user ssh backup.server doveadm dsync-server -u user
But it's possible to use replicator service to do the same job? Or dsync
with replicator can only be used in a two-way environment?
Thanks,
Muriel
2006 Oct 03
2
strverscmp, scandir, alphasort and versionsort
Hello,
These are implementations of strverscmp, scandir, alphasort and
versionsort, and some test cases for them.
I know these aren't in POSIX, but they're useful, nonetheless, and
someone else might be interested in them.
Regards,
Luciano Rocha
--
lfr
0/0
-------------- next part --------------
/* ----------------------------------------------------------------------- *
*
*
2017 Jan 26
0
RFC: tapply(*, ..., init.value = NA)
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
FUN=all, -Inf for FUN=max, etc. But that would take time and would
break code for which FUN did not work on length-0 objects.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Thu, Jan 26, 2017 at 2:42 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote: