It’s been a while since my last post. It’s time to catch up!

Every time I write a paper or report, I need to create descriptive tables using Latex. Over and over I create Adhoc tables, and I say to myself: Write a general function so you can save time in the next paper! I know there are some solutions out there, but in general, I feel they are not flexible enough.

I introduce a far from perfect function to create descriptive tables in Latex. The steps and structure are quite simple:

1. Write a function to summarize your data with any stats you want
2. Define a list with the data plus column names (labels)

That’s it. You can see the function here. It has some features might be useful:

• It deals automatically with factors (categorical variables)
• You can use different datasets at the same time
• You can group columns using a variable (e.g., year)
• You can add long notes at the bottom of the table
• You can specify your own descriptive function

Let’s start creating some fake data:

• 5 variables
• Variable 3 is a factor (i.e., categorical)
• Variable 5 is a grouping column

We can define a descriptive function:

Thus, the grouping of rows is defined by the name of each dataset in the list. We can add a note, just remember to add \usepackage[flushleft]{threeparttable} to your Latex document:

We can also slice the descriptives by group:

It’s just a first version. I will add more features soon.