Displaying 20 results from an estimated 10000 matches similar to: "aggregate.formula implicitly removes rows containing NA"
2010 Nov 17
2
Bug in agrep computing edit distance?
I posted this yesterday to r-help and Ben Bolker suggested reposting it
here...
Dickison, Daniel <ddickison <at> carnegielearning.com> writes:
>
> The documentation for agrep says it uses the Levenshtein edit distance,
> but it seems to get this wrong in certain cases when there is a
> combination of deletions and substitutions.  For example:
>
> >
2010 Nov 16
1
Bug in agrep computing edit distance?
The documentation for agrep says it uses the Levenshtein edit distance,
but it seems to get this wrong in certain cases when there is a
combination of deletions and substitutions.  For example:
> agrep("abcd", "abcxyz", max.distance=1)
[1] 1
That should've been a no-match.  The edit distance between those strings
is 3 (1 substitution, 2 deletions), but agrep matches
2011 Jan 22
2
meaning of formula in aggregate function
Dear R community
Recently, dear Henrique Dallazuanna literally saved me solving one
problem on data transformation which follows:
(n_, _n, j_, k_ signify numbers)
SOURCE DATA:   
id      cycle1  cycle2  cycle3  ?       cycle_n
1       c       c       c               c
1       m       m       m               m
1       f       f       f               f
2       m       m       m               NA
2 
2004 May 26
0
aggregate.formula
This relates to a message from Christophe Pallier to r-help some time ago.
Like myself, he finds aggregate very useful, but the interface a little
cumbersome. I've implemented a more compact formula interface, found at
the bottom of this message:
 data(ToothGrowth)
 # I used to aggregate like this:
 aggregate(list(len=ToothGrowth$len),
          
2012 Oct 31
1
aggregate.formula: formula from string
Dear all,
I want to use aggregate.formula to conveniently summarize a data.frame. I have quiet some variables in the data.frame and thus I don't want to write all these names by hand, but instead create them on the fly. This approach has the advantage that if there will be even more columns in the data.frame I don't have to change the code.
I've hence tried to construct a formula
2011 Jan 26
1
aggregate(as.formula("some formula"), data, function) error when called from in a function
I'm having a problem with aggregate.formula when I call it in a function and the function is converted from a string in the funtion
I think my problem may also only occur when the left hand side of the formula is cbind(...)
Here is example code that generates a dataset and then the error. 
The first function "agg2" fails
> agg2(FALSE)
do agg 2
Error in m[[2L]][[2L]] : object
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
2010 Nov 29
3
data.frame and formula classes of aggregate
Hi - I apologize for the 2nd post, but I think my question from a few weeks
ago may have been overlooked on a Friday afternoon.
I might be missing something very obvious, but is it widely known that the
aggregate function handles missing values differently depending if a data
frame or a formula is the first argument ?  For example, 
(d<- data.frame(sex=rep(0:1,each=3),
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello!
I am aggregating using a formula in aggregate - of the type:
aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata)
However, I actually have an object (vector of my variables to be aggregated):
myvars<-c("var1","var2","var3")
I'd like my aggregate formula (its "cbind" part) to be able to use my
"myvars" object. Is it
2006 Feb 24
1
(Newbie) Aggregate for NA values
Folks,
Sorry if this question has been answered before or is obvious (or
worse, statistically "bad"). I don't understand what was said in one
of the search results that seems somewhat related.
I use aggregate to get a quick summary of the data. Part of what I am
looking for in the summary is, how much influence might the NA's have
had, if they were included, and is excluding
2008 Jul 08
1
aggregate() function and na.rm = TRUE
All,
I've been using aggregate() to compute means and standard deviations at
time/treatment combinations for a longitudinal dataset, using na.rm = TRUE
for missing data. 
This was working fine before, but now when I re-run some old code it isn't.
I've backtracked my steps and can't seem to find out why it was working
before but not now.  In any event, below is a reproducible
2007 Jul 31
1
aggregate.data.frame - prevent conversion to factors? show statistics for NA values of "by" variable?
I have a two question regarding the "aggregate.data.frame" method of the "aggregate" function.
My situation:
a. My "x" variable is a data.frame ("mydf") with two columns, both columns of type/format "numeric".
b. My "by" variable is a data.frame("mybys") with two columns, both columns of type/format "character".
c.
2006 Jun 08
8
another routes question
i need help setting up the routes for my app.
I have created about 10 controllers in the app/controllers/pro 
directory:
app/controllers/pro/address_controller.rb
app/controllers/pro/certification_controller.rb
app/controllers/pro/program_controller.rb
app/controllers/pro/program_controller.rb
and so on...
The problem is that I would like to also use app/controllers/pro as a 
controller; so
2006 Oct 01
3
aggregate function with 'NA'
Dear r-help reader,
I have some problems with the aggregate function.
My datframe looks like
 >frame
   Day Time V1 V2
1   M    0  3 NA
2   M    0  4 NA
3   M    0  5  2
4   M    1 NA  4
5   M    1 10  6
6   T    0  4 45
7   T    1  4  3
8   T    1  3  2
9   T    1  6  1
I used the aggegate function to obtain the mean in V1 and V2 over the 
grouping variable
Time and Day
 
2005 Sep 12
3
monitor peak channel use
Is there a way to trigger an action when a certain number of zap
channels are in use, or is there a variable that stores max used
channels that can be read?
I use PRI for inbound calls, but outbound goes out via SIP, so the
simple solution does not work.
I need to know when the potential exists for inbound calls via
PRI/Wildcard to be blocked because there are no more channels.
Obviously
2012 Dec 16
3
how to handle NA values in aggregate()
Dear All:
I am trying to calculate four columns' means in a dataframe like this:
FID  MID     IID         EW_INCU EW_17.5   EMW        EEratio
1   4621  TWF2H5    45.26        NA             15.61         NA
1   4621  TWF2H6    48.02        44.09         13.41      0.3041506
2   4630  TWF2H19   51.44       47.81         NA             NA
2   4631  TWF2H21   NA          52.72         16.70   
2009 Jun 17
1
RWeka evaluate classifier on test set
Hi everyone,
I have a test set with more than 1000 cases, when I use 
evaluate_Weka_classifier(RWeka)to evaluate my classifier on this test 
set, the output shows me the result of only 83 cases. I do have 
missing values in predictors, so I tried na.acton=na.pass, but it 
dosen't help. Now I confused, why RWeka ignore so many cases in my 
test set? Is there any setting I didn't notice in 
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle. 
 
> set.seed(143)
> m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T))
> m
   A B  C  D
1  E I  1 NA
2  A C NA NA
3  D I NA  3
4  C I
2002 Oct 09
5
polynomial
Any better (more efficient, built-in) ideas for computing 
 coef[1]+coef[2]*x+coef[3]*x^2+ ...
 than
polynom <- function(coef,x) {
  n <- length(coef)
  
sum(coef*apply(matrix(c(rep(x,n),seq(0,n-1)),ncol=2),1,function(z)z[1]^z[2]))
}
?
  Ben
-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
2012 Feb 06
1
na.action in stats::factanal() must be using formula interface and dataframe input to specify na.action?
hi,
Does factanal() force the user to use the formula interface if they wish to specify an na.action?
v1 <- c(1,1,1,1,1,1,1,1,NA,1,3,3,3,3,3,4,5,6)
v2 <- c(1,2,1,1,1,1,2,1,2,1,3,NA,3,3,3,4,6,5)
v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
v4 <- c(3,3,4,NA,3,1,1,2,1,1,1,1,2,NA,1,5,6,4)
v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
m1