Re: [R] aggregate formula - differing results

2023-09-04 Thread Achim Zeileis
On Mon, 4 Sep 2023, Ivan Calandra wrote: Thanks Rui for your help; that would be one possibility indeed. But am I the only one who finds that behavior of aggregate() completely unexpected and confusing? Especially considering that dplyr::summarise() and doBy::summaryBy() deal with NAs differe

Re: [R] aggregate formula - differing results

2023-09-04 Thread Bert Gunter
Ivan: Just one perhaps extraneous comment. You said that you were surprised that aggregate() and group_by() did not have the same behavior. That is a misconception on your part. As you know, the tidyverse recapitulates the functionality of many base R functions; but it makes no claims to do so in

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
Haha, got it now, there is an na.action argument (which defaults to na.omit) to aggregate() which is applied before calling mean(na.rm = TRUE). Thank you Rui for pointing this out. So running it with na.pass instead of na.omit gives the same results as dplyr::group_by()+summarise(): aggregate(

Re: [R] aggregate formula - differing results

2023-09-04 Thread Rui Barradas
Às 12:51 de 04/09/2023, Ivan Calandra escreveu: Thanks Rui for your help; that would be one possibility indeed. But am I the only one who finds that behavior of aggregate() completely unexpected and confusing? Especially considering that dplyr::summarise() and doBy::summaryBy() deal with NAs d

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
Thanks Rui for your help; that would be one possibility indeed. But am I the only one who finds that behavior of aggregate() completely unexpected and confusing? Especially considering that dplyr::summarise() and doBy::summaryBy() deal with NAs differently, even though they all use mean(na.rm

Re: [R] aggregate formula - differing results

2023-09-04 Thread Rui Barradas
Às 10:44 de 04/09/2023, Ivan Calandra escreveu: Dear useRs, I have just stumbled across a behavior in aggregate() that I cannot explain. Any help would be appreciated! Sample data: my_data <- structure(list(ID = c("FLINT-1", "FLINT-10", "FLINT-100", "FLINT-101", "FLINT-102", "HORN-10", "HORN

Re: [R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
no missing data. > > Iago > > *De:* R-help de part de Ivan Calandra > > *Enviat el:* dilluns, 4 de setembre de 2023 11:44 > *Per a:* R-help > *Tema:* [R] aggregate formula - differing results > Dear useRs, &g

Re: [R] aggregate formula - differing results

2023-09-04 Thread Iago Giné Vázquez
has no missing data. Iago De: R-help de part de Ivan Calandra Enviat el: dilluns, 4 de setembre de 2023 11:44 Per a: R-help Tema: [R] aggregate formula - differing results Dear useRs, I have just stumbled across a behavior in aggregate() that I cannot explain

[R] aggregate formula - differing results

2023-09-04 Thread Ivan Calandra
Dear useRs, I have just stumbled across a behavior in aggregate() that I cannot explain. Any help would be appreciated! Sample data: my_data <- structure(list(ID = c("FLINT-1", "FLINT-10", "FLINT-100", "FLINT-101", "FLINT-102", "HORN-10", "HORN-100", "HORN-102", "HORN-103", "HORN-104"), Edge