What does the t in tapply stand for?

Stands for table since tapply is the generic form of the table function. You can see this by comparing the following calls:

x <- sample(letters, 100, rep=T)
table(x)
tapply(x, x, length)

although obviously tapply can do more than counting.

Also, some references that refer to "table-apply":

  • R and S Plus companion
  • Modern Applied Biostatistical Methods

I think of it as 'table'-apply since the result comes as a matrix/table/array and its dimensions are established by the INDEX arguments. An R table-classed object is really very similar in contrcution and behavior to an R matrix or array. The application is being performed in a manner similar to that of ave. Groups are first assembled on the basis of the "factorized" INDEX argument list (possibly with multiple dimensions) and a matrix or array is returned with the results of the FUN applied to each cross-classified grouping.

The other somewhat similar function is 'xtabs'. I keep thinking it should have a "FUN" argument, but what I'm probably forgetting at that point is really tapply.


tapply is sort of the odd man out. As far as I know, and as far as the R documentation for the apply functions goes, the 't' does not stand for anything, unlike the other apply functions which indicate the input or output options.

Tags:

R

Tapply