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

2024-03-28 Thread Ogbos Okike
This is great! Many thanks to all for helping to further resolve the problem. Best wishes Ogbos On Fri, Mar 29, 2024 at 6:39 AM Rui Barradas wrote: > Às 01:43 de 29/03/2024, Ogbos Okike escreveu: > > Dear Rui, > > Thanks again for resolving this. I have already started using the version > > that

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

2024-03-28 Thread Rui Barradas
Às 01:43 de 29/03/2024, Ogbos Okike escreveu: Dear Rui, Thanks again for resolving this. I have already started using the version that works for me. But to clarify the second part, please let me paste the what I did and the error message: set.seed(2024) data <- data.frame( +Date = sample(

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

2024-03-28 Thread Jeff Newmiller via R-help
I would guess your version of R is earlier than 4.1, when the built-in pipe was introduced to the language On March 28, 2024 6:43:05 PM PDT, Ogbos Okike wrote: >Dear Rui, >Thanks again for resolving this. I have already started using the version >that works for me. > >But to clarify the second p

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

2024-03-28 Thread Ogbos Okike
Dear Deepayan, Thanks for your kind response. Regards Ogbos On Thu, Mar 28, 2024 at 3:40 AM Deepayan Sarkar wrote: > For more complicated examples, the (relatively new) array2DF() > function is also useful: > > > with(data, tapply(count, Date, mean)) |> array2DF() > Var1Value > 1 202

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

2024-03-28 Thread Ogbos Okike
Dear Rui, Thanks again for resolving this. I have already started using the version that works for me. But to clarify the second part, please let me paste the what I did and the error message: > set.seed(2024) > data <- data.frame( +Date = sample(seq(Sys.Date() - 5, Sys.Date(), by = "1 days")

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

[R] Output of tapply function as data frame

2024-03-26 Thread Ogbos Okike
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 below. But an effort to write AB to a file as a