similar to: tapply huge speed difference if X has names

Displaying 20 results from an estimated 11000 matches similar to: "tapply huge speed difference if X has names"

2013 Jul 17
2
error message in gev
  Hi r-users,   I would like to use gev and my data (annual rainfall ) is as follows:   > head(dat,20) A B C D E F G H I J 1 45.1 41.5 58.5 50.1 46.0 49.1 37.7 49.1 59.8 54.0 2 50.3 39.8 49.4 56.4 49.4 48.8 42.1 49.8 49.4 58.3 3 41.7 39.3 44.6 39.1 35.7 41.5 40.8 40.8 38.5 45.6 4 50.7 33.9 48.4 28.2 35.5 39.1 61.4 17.0 30.7 38.3 5 39.3 30.6 46.9 23.8 25.8
2012 Nov 14
2
aggrete data from combination
Dear R users, A have a dataframe (matrix) with two collumns (plot, and diameter (d)). I want all diameters values for different combination of plots. For example I want all d values for all posible combination, 100C2 (all d values for plot 1 with all d values in the plot 2.......with all d values from plot 1 with all d values from plot 100, ...... with all d values from plot 99 with all d values
2008 Jun 04
2
Question about subsetting data
I have a data set(Bill) of with 1 variable (var1), with 100 obs that are in ascending order. I want to sample every 10 observations and save them in 10 different groups such as Group1 is obs 1-10 Group 2 is obs-11-20 and so on. First step is to subset them into the 10 groups, then calculate the mean of var1 for each of the 10 groups. Any help would be appreciated. Thanks.
2012 Mar 14
2
aggregate
Dear all I am having a vector with large length and I would like to ask you if I can aggregate the values by constant sized windows. For example for the following vector, I would like to take 30 points until the end and find their mean. > myData<-seq(1:100000) > > c(mean(myData[1:30]),mean(myData[31:60])) #...and so one until the end [1] 15.5 45.5 I have searched in the R
2001 May 09
7
R-Quant
Greetings, Does anyone know if R-Quant, http://www.smartquant.com/ an outgrowth of the statistical package "R"? Bill Vedder -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the
2004 Mar 15
2
Bug in tapply with factors containing NAs (PR#6672)
Full_Name: George Leigh Version: 1.8.1 OS: Windows 2000 Submission from: (NULL) (203.25.1.208) The following example gives the correct answer when the first argument of tapply is a numeric vector, but an incorrect answer when it is a factor. If the function used by tapply is "length", the type and contents of the first argument should make no difference, provided it has the same
2006 Aug 10
3
Multiple density curves
Hi, I am new to R...a recent convert from SAS. I have a dataset that looks like this: SEQ A1 A2 A 532.5 554.5 B 25.5 35.5 C 265.2 522.2 D 245.55 521.56 E 546.52 141.52 F 243.25 32.56 G 452.55 635.56 H 15.14 16.54 I 543.4 646.56 J 54.4 654.5 K 646.5 64.54 L 645.4 614.46 M 646.54 634.46 I want to make a histogram
2012 Jul 06
4
differences between survival models between STATA and R
Dear Community, I have been using two types of survival programs to analyse a data set. The first one is an R function called aftreg. The second one an STATA function called streg. Both of them include the same analyisis with a weibull distribution. Yet, results are very different. Shouldn't the results be the same? Kind regards, J -- View this message in context:
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
2013 Jun 12
1
Question on Simple Repeated Loops
Dear R-User, Appreciate any helps. It looks simple, but I don't have a clue. Given that I have a dataframe of tree population with three variables: sp=species , d0=initial_size grow=growth increment from initial size per year How can I calculate the future growth increment of each tree for the next 3 years. The following Rscript was written, #---------- a0 <-
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:
2008 Jul 08
0
Fwd: Re: extracting index list when using tapply()
The following message is provided by Erik Please provide the reproducible code to do this. Generate a sample data set using the random data generating functions and show us what you'd like, we can then more easily help. ctu at bigred.unl.edu wrote: > Hi, > How about using "subset"? > x1<-tapply(subset(years, length(area)>20), function(x) length(unique(x))) >
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
2007 Jun 18
1
getting tapply() to work across multiple columns
I have the following data.frame: index <- c("a","a","b","b","b") alpha <- c(1,2,3,4,5) beta <- c(2,3,4,5,6) table <-data.frame(index,alpha,beta) I'm now interested in getting means of alpha and beta for each of the index values and do a tapply() for each of the columns, e.g. means.alpha <- tapply(table$alpha, index,mean)
2017 Jan 27
0
RFC: tapply(*, ..., init.value = NA)
> 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 > FUN=all, -Inf for FUN=max, etc. But that would take time and would > break code for which FUN did not work on
1999 Feb 19
1
Potential problem with tapply
Is the following behaviour of tapply not disappointing? Problem with tapply occurs when dealing with na.rm when an argument additional to na.rm is sent to the applied function (here quantile). Any comment? Thank you, Philippe Lambert > x <- c(12,10,12,2,4,11,3,7,2,1,18,7,NA,NA,7,5) > fac <- gl(4,4,16) > # Works fine > tapply(x,fac,quantile,na.rm=T) $"1" 0% 25%
2004 May 13
2
tapply & hist
I'm learning how to use tapply. Now I'm having a go at the following code in which dati contains almost 600 lines, Pot - numeric - are the capacities of power plants and SGruppo - text - the corresponding six technologies ("CCC", "CIC","TGC", "CSC","CPC", "TE"). .....................................................
2012 Sep 03
1
Scatter plot from tapply output, labels of data
Hei, i am trying to plot the means of two variables (d13C and d15N), by 2 grouping factors (Species and Year) that i obtained by the function tapply. I would like to plot with different colours according to the Year and show the "Species" as data labels. My data looks like this: Species d13C d13N Year "Species1" 14,4 11.5 2009 "Species2"
2009 Dec 01
1
Remark on tapply().
Consider the following: > set.seed(42) > ff <- factor(sample(c(1,3,5),42,TRUE),levels=1:5) > x <- runif(42) > tapply(x,ff,sum) 1 2 3 4 5 3.675436 NA 7.519675 NA 9.094210 I got bitten by those NAs in the result of tapply(). Effectively one is summing over the empty set, and consequently (according to what I learned as a child)
2005 Jan 26
0
tapply with weighted.mean
We were caught out recently attempting to use tapply to get a table of weighted means. This gives the wrong answer (or, more correctly, not the answer we were expecting), as the following example shows: R> x <- 1:10 #some data R> w <- c(1:5,5:1) #weights R> id <- rep(1:2,rep(5,2)) #id values R> weighted.mean(x[id==1],w[id==1]) #Weighted mean of x in group 1 [1] 3.666667