Re: [R] Output of tapply function as data frame

2024-03-27 Thread Deepayan Sarkar
For more complicated examples, the (relatively new) array2DF() function is also useful: > with(data, tapply(count, Date, mean)) |> array2DF() Var1Value 1 2024-03-23 5.416667 2 2024-03-24 5.50 3 2024-03-25 6.00 4 2024-03-26 4.476190 5 2024-03-27 6.538462 6 2024-03-28 5.20 o

Re: [R] Output of tapply function as data frame: Problem Fixed

2024-03-27 Thread Rui Barradas
Às 08:58 de 27/03/2024, Ogbos Okike escreveu: Dear Rui, Nice to hear from you! I am sorry for the omission and I have taken note. Many thanks for responding. The second solution looks elegant as it quickly resolved the problem. Please, take a second look at the first solution. It refused to ru

[R] Output of tapply function as data frame: Problem Fixed

2024-03-27 Thread Ogbos Okike
Dear Rui, Nice to hear from you! I am sorry for the omission and I have taken note. Many thanks for responding. The second solution looks elegant as it quickly resolved the problem. Please, take a second look at the first solution. It refused to run. Looks as if the pipe is not properly position

Re: [R] Output of tapply function as data frame

2024-03-27 Thread Rui Barradas
Às 04:30 de 27/03/2024, Ogbos Okike escreveu: Warm greetings to you all. Using the tapply function below: data<-read.table("FD1month",col.names = c("Dates","count")) x=data$count f<-factor(data$Dates) AB<- tapply(x,f,mean) I made a simple calculation. The result, stored in AB, is of the form