search for: ave

Displaying 20 results from an estimated 3340 matches for "ave".

Did you mean: are
2009 Apr 09
2
numbers not behaving as expected
If someone can explain this odd behavior I'd appreciate it. I have a data.frame Cell.ave (attached and created via dput(Cell.ave, "Cell.ave") which contains three columns of parameters year, month and AveRain. I need to subset the data.frame by months such that DrySeaonMonths are 1,2,3,4, 11, and 12 or Jan - April, November and December and WetSeason...
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" "A" &qu...
2009 Mar 25
1
Requesting help with lattice again
...the panels. Is there a way to address this? thank you very much for the assistance. Steve This is part of the larger data base, after I passed it thru melt. Region Species Scenario HydroState HSI 1 Eastern Panhandle WBLong NSM Ave 0.165945170 2 Eastern Panhandle WBLong NSM Dry 0.056244263 3 Eastern Panhandle WBLong NSM Wet 0.290692607 4 Eastern Panhandle WBLong ECB Ave 0.165945170 5 Eastern Panhandle WBLong...
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...
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 = T)) d$avy2 <- ave(d$y, interaction(d$grp1, d$grp2, drop = T)) }) # user system elapsed # 6.73...
2015 Jul 27
4
Como modificar valores en un data frame
Estimad en s, quería realizar una consulta Dado un data frame llamado aves, como puedo sustiuir las variables area, dist y distm por sus logaritmos en base10 y volver a crear un data frame? Muchas gracias Saludos Susana [[alternative HTML version deleted]]
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 repeated. What...
2013 Apr 09
4
Boxplot Labels OK
Dear all, I have just sent an enquiry but probably I hadn’t expressed myself properly. Could anyone help me with the following? When I run the code on my data I get a boxplot with outliers identified by numbers 200 & 201. However, what I would like is to label these outliers with their corresponding “DATA$nu...
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 -I...
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 > 7 C 2 0.2500000 > 8 C 6 0.2500000 > > Getting the mean is no problem ;...
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 t...
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 man...
2010 Jan 20
5
standardizing one variable by dividing each value by the mean - but within levels of a factor
Hello! I have a data frame with a factor and a numeric variable: x<-data.frame(factor=c("b","b","d","d","e","e"),values=c(1,2,10,20,100,200)) For each level of "factor" - I would like to divide each value of "values" by the mean...
2014 Jan 12
6
Duda Regresión Multiple
Buenos días, Me gustaría aplicar una regresión múltiple a los datos con los que trabajo pero no se como introducir los datos en R. He probado introducir el siguiente comando: modeloM<-lm(AVE.~ d1 + as.factor(d1T)*Tariff) summary(modeloM) Pero me da el siguiente error: > summary(modeloM) Error in if (attr(z$terms, "intercept")) sum((f - mean(f))^2) else sum(f^2) : argument is of length zero Mi intención es calcular la siguiente regresión: Ave = cte + d1*coeficiente1 +...
2008 Aug 25
3
lmer4 and variable selection
...ring birds. My original model contains quite a few dependent variables, but I do not (of course) wish to keep them all in my final model. I've fitted the following model to the data: > temp.lme1<-lmer(T.B~tarsus+wing+weight+factor(age)+factor(sex)+fat+minsunset+day1oct+day1oct.2+minnight+ave.day+minnight.1+T.A+ave.night.1+(1|ID)+(1|sign),data=bodytemp.df) where T.B equals body temperature; explanatories are a number of biometric measures (tarsus, wing, weight, fat, age, sex) and various measures of ambient temperature (ave.day, minnight.1, minnight, ave.night.1, T.A) and time/date (...
2010 Mar 05
2
How to assign week numbers to a time-series
...gned 3, and so on. In this scheme, weekdays are such that SAT=1, SUN=2, MON=3,.....FRI=7. I am basically trying to assign week numbers to potential sampling days in a survey season for use in a program that will generate a fisheries creel survey schedule. I should note that if element 1 happens to have DOW=SAT (that is the case this year, since the first day of our survey 05/01 is a Saturday), then WEEK 1 begins on day 1 (05/01/2010) and WEEK 2 will begin on the first SAT under variable DOW. I hope I explained this clearly enough, if not let me know. Mike MM DD YR DOW DOW. DTYPE TOD...
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 == 0, FUN = sd) Thank you for any help! Patrick
2009 Apr 15
0
ave returns wrong type
I've been using the ave function to compute some statistics on a data frame. After a while I noticed that, for some reason, it was returning numerical statistics as strings instead of numbers. I delved into the code of the functions and traced the problem to the following fact: ave uses split<- to do its wo...
2014 Jan 14
2
Duda Regresión Multiple
Buenos días, *Muchas gracias, todas las aportaciones han sido bien útiles.* Las he tenido en cuenta y he pasado los datos con el R, siguiendo el siguiente comando: *modeloRTUN2<-lm(AVE.~ Tariff + d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9+ d10 + d11+ d12+ d13+ d14+ d15+ d16+ d17+ d18+ d19+ d20 +d21 + Tariff*d1 + Tariff*d2 + Tariff*d10)* *summary(modeloRTUN2)* Siendo: AVE. = Variable dependiente (explicada) Tariff = Variable dependiente (explicativa) d1.....d22= los diferente...
2011 May 03
6
Simple loop
Hello everybody, I am beginning with loops and functions and would be glad to have help in the following question: If i have a dataframe like this Site Prof H 1 1 24 1 1 16 1 1 67 1 2 23 1 2 56 1 2 45 2 1 67 2 1 46 And I would like to create a new column that subtracts the minimum of H from H, but f...