I have a function of this form
Garch[a,b,c....]
that gives me a list as an output,where the first column collects names of output variables.
Is it possible to customize TableForm
so that when I evaluate:
Garch[a,b,c...]//TableForm
it takes that first column and displays it as a column table heading, and the rest columns as data?
I don't want to make another function for this because I want to make it as simple as possible.
The function should look something like this:
TableForm[ Garch[a_, b_, c_, ___]] :=
TableForm[ Garch[a, b, c][[All, 2 ;; -1]],
TableHeadings -> {ToString /@ Garch[a, b, c][[All, 1]], None}]
So,I'll try to be more precise.The reason I don't want to define a new function is because in the end I want to create a compact mathematica package(this is part of my master thesis) that other students would use without learning another function. If you are familiar with RLink and the mathematica representation of data.frame object you'll understand what I mean.For example evaluate the next code:
Needs["RLink`"]
InstallR[]
REvaluate["data.frame(a=c(1,2,3),b=c(4,5,6))"]
Now when we do
REvaluate["data.frame(a=c(1,2,3),b=c(4,5,6))"]//TableForm
we should get the table with row names 1,2,3 and column names a,b.So I'm guessing that TableForm is somehow modified to recognize the functions in first output and show them like in the second case. Analogically to this I would like to modify the TableForm function to recognize my Garch function and do the operations you suggested.