Displaying 20 results from an estimated 9000 matches similar to: "ave returns wrong type"
2010 May 02
2
Retrieve regular expression groups
I'm trying to figure out how to get the text captured by capturing
groups out of a regex match. For instance, let's say I have the pattern
"foo ([^ ]+)" and I match it against the string "This is a foo sentence
I am reading." The group in the pattern will match the word "sentence"
in the target string. How can I get access to this matched group? All
I
2009 Sep 16
2
Generalized cumsum?
Is there anything like cumsum and cumprod but which allows you to
apply an arbitrary function instead of sum and product? In other words,
I want a function cumfunc(x, f) that returns a vector, so that for all n
up to the length of x
cumapply(x,f)[n] = f(x[1:n])
This would give cumsum and cumprod as special cases when f=sum or
f=prod.
I could write such a function, but I can't see
2009 Sep 16
1
Windows RGui line editing
I've been using Tinn-R with RGui on Windows for quite some time
now, but it's very irritating how the Windows RGui allows only very
rudimentary line-editing. I can't even use shift-arrow key to select
text!
I searched through the archives and found what seemed to be a few
people asking about this, but I couldn't find a clear answer. I saw
some references in the docs to
2009 Apr 19
1
ave returns wrong data type (PR#13664)
Full_Name: Brendan Barnwell
Version: 2.9.0
OS: Windows XP Pro
Submission from: (NULL) (71.102.131.29)
The ave() function returns an incorrect datatype. Specifically, ave(x, g, f)
always returns a vector with the same mode as x, rather than using the mode of
the vector returned by f. Observe:
> x
[1] "A" "B" "C" "A" "B" "C"
2009 Jul 07
0
rsync-3.0.6 regression test problems
Hi,
I've build rsync-3.0.6 on a number of legacy unix systems, and on a few
systems the regression tests showed up with some errors:
HP-UX 11.11 and 11.23 (ia64):
FAIL chown
FAIL dir-sgid
FAIL fuzzy
FAIL itemize
IRIX 6.5.13m:
FAIL chown
FAIL fuzzy
FAIL itemize
MacOS-X 10.4:
FAIL chgrp
the errors on "fuzzy" and "itemize" are
2007 Nov 16
0
Odp: R: ave and quantile
Hi
Patrick Hausmann <c18g at uni-bremen.de> napsal dne 15.11.2007 18:59:06:
> Hello Petr,
>
> one question solved, the next is standing in front of me... If you
> have a minute to look .... great!
>
> > x
> V1 V2 F1
> 1 A 2 0.1552277
> 2 A 3 0.1552277
> 3 A 4 0.1552277
> 4 B 3 0.8447723
> 5 B 2 0.8447723
> 6 C 6 0.2500000
2010 Jun 29
1
Performance enhancement for ave
library(plyr)
n<-100000
grp1<-sample(1:750, n, replace=T)
grp2<-sample(1:750, n, replace=T)
d<-data.frame(x=rnorm(n), y=rnorm(n), grp1=grp1, grp2=grp2)
system.time({
d$avx1 <- ave(d$x, list(d$grp1, d$grp2))
d$avy1 <- ave(d$y, list(d$grp1, d$grp2))
})
# user system elapsed
# 39.300 0.279 40.809
system.time({
d$avx2 <- ave(d$x, interaction(d$grp1, d$grp2, drop =
2002 Mar 20
0
Question re:S4 classes and design; clashing classes?
On Wed, 20 Mar 2002, John Chambers wrote:
> It wasn't entirely clear what your design goals were, but the general
> question of comparing functional method languages (S, CLOS, Dylan) and
> OOP languages (Java, etc) is of much interest to me, so here are some
> general comments. Maybe we can then iterate on your example, with or
> without r-devel.
I'll keep it on r-devel
2004 Apr 19
0
looking for something like "ave" I can pass non numeric to
Hi,
I have been trying to calculate summary error and coding statistics on
a by subject basis and seem to be writing a lot of code to do a simple
thing. I won't go into my messy version. What I am asking is if
anyone knows of a single command that could take the following data and
get error rates over a given vector.
Given data from ss with,,,
subj a rt code
1 1 200 good
1 1 321 good
2007 May 08
0
The match of "ave()" for "FUN=SD"
Hello,
I have many subsets of x. I want to get the standard deviation
for each subset with the same factor levels. For "FUN=mean" and
"FUN=median" I am using "ave()".
Can anybody tell me the match of "ave()" for using "FUN=SD"?
At the beginning I used aggregate(), also for mean and median. But
aggregegate make ""arithmetical
2009 Jan 15
0
help text for ave()
Dear R developers,
In the help text for ave() you can read in Arguments section:
"... Grouping variables, typically factors, all of the same length as x"
...and in Value: "If ... is g1,g2,".
I think a description in the Arguments section of how two or more
grouping variables is specified together with an Example would be very
helpful.
In absence of a help text I just
2017 Jun 14
1
spurious warning in ave()
Consider the following simple data set and a call to ave:
> tdata <- data.frame(f1=c(1,1,1,1,2,2,2,2), f2=c(1,2,1,2,1,1,1,1), y=1:8)
> with(tdata, table(f1, f2))
f2
f1 1 2
1 2 2
2 4 0
> with(tdata, ave(y, f1, f2, FUN=max))
[1] 3 4 3 4 8 8 8 8
Warning message:
In FUN(X[[i]], ...) : no non-missing arguments to max; returning -Inf
There are no missing values in the
2007 Nov 21
1
ave and sd
Dear list,
I'm still trying to calculate the sd for V2 for
each group in V1 if V3 is '0':
> x
V1 V2 V3
1 A01 2.40 0
2 A01 3.40 1
3 A01 2.80 0
4 A02 3.20 0
5 A02 4.20 0
6 A03 2.98 1
7 A03 2.31 0
8 A04 4.20 0
# Work
x$vmean <- ave(x$V2, x$V1, x$V3 == 0, FUN = mean)
# Work
x$vsd2 <- ave(x$V2, x$V1, FUN = sd)
# Doesn't work
x$vsd <- ave(x$V2, x$V1, x$V3
2010 Aug 20
2
Problem with POSIXct in ave
Hi,
I am having trouble using the ave function with a POSIXct object. For
example:
x<-Sys.time()+0:9*3600
dat<-data.frame(id=rep(c('a','
b','c'),each=10),dt=rep(x,3),i=rep(1:10,3))
dat
# This is what I want to do:
dat$time.elapsed<-unsplit(lapply(split(dat$dt,dat$id),function(x)
x-x[1]),f=dat$id)
dat
# The above code does the trick, but from the standpoint of
2017 Mar 28
4
[Bug 1139] New: The include guards on the include/libipset/linux_ip_set*.h are wrong
https://bugzilla.netfilter.org/show_bug.cgi?id=1139
Bug ID: 1139
Summary: The include guards on the
include/libipset/linux_ip_set*.h are wrong
Product: ipset
Version: unspecified
Hardware: x86_64
OS: All
Status: NEW
Severity: enhancement
Priority: P5
Component:
2009 Feb 15
2
Fast ave for sorted data?
Hi,
This is probably really obvious, by I can't seem to find anything on it.
Is there a fast version of ave for when the data is already sorted in
terms of the factor, or if the breaks are already known?
Basically, I have:
X = 0.1, 0.2, 0.32, 0.32, 0.4, 0.56, 0.56, 0.7...
Y = 223, 434, 343, 544, 231.... etc
of the same, admittedly large length.
Now note that some of the values of X are
2004 Oct 22
1
ave gives unexpected NA's
[R 2.0.0 on Linux]
I tried:
> df <- data.frame(
grp1=factor( c('A' ,'A' ,'A' ,'D', 'D' ) ) ,
grp2=factor( c('a1','a2','a2','d1','d1') )
)
> df
grp1 grp2 val
1 A a1 1
2 A a2 2
3 A a2 4
4 D d1 8
5 D d1 16
I got:
> with( df, ave( val, grp1, grp2, FUN=sum ) )
2009 Mar 02
2
ave and grouping
Dear list,
# I have a DF like this:
sleep$b <- c(rep(8,10), rep(9,10))
sleep$me <- with(sleep, ave(extra, group, FUN = mean))
sleep
# I would like to create a new variable
# holding the b-th value of group 1 and 2.
# This is not what I want, it takes always the '8' from group '1'
# and not the '9'
sleep$gr <- with(sleep, ave(extra, group, FUN = function(x)
2012 Dec 24
2
parallelized version of "by" and "ave"
Dear R experts---
Has anyone written parallel versions of "by" (i.e., mcby) and "ave"
(i.e. mcave) ? I did ask a question like this a year ago, and then
the answer was no.
for those who are googling the group for the answer to this question,
in the meantime, the poor man's version of "by" is mclapply( split(
ds, factor ), FUN )
I don't know the poor
2013 Aug 22
0
[LLVMdev] PrescheduleNodesWithMultipleUses() causing failure in PickNodeToScheduleBottomUp() ???
sorry,
Just noticed that the diagrams have 'Destroy' & 'SetUp' the wrong way around!
Robert
________________________________
From: llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] on behalf of Robert Lytton [robert at xmos.com]
Sent: 21 August 2013 18:34
To: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] PrescheduleNodesWithMultipleUses() causing failure in