2
I have my database from the package hflights
of the R, which shows a number of flights in the US. I need to calculate the average distance travelled (Distance
) for each day of the week (variable DayofWeek
) between flights with a delay of more than 60 and between flights with a delay of less than 60 (variable DepDelay
). It is necessary to use a single tapply
.
I tried something like this, but it’s wrong:
y=(c(which(sapply(dados,is.numeric))))y
apply(as.matrix(y),1,function(x){tapply(dados[,x],list(dados$DayofWeek,dados$DepDelay>60),mean)})
Felipe if any answer answered your question, you can accept it by clicking the green ok button on the left side of the answer.
– Carlos Cinelli