Reputation: 1
Apologies for the rather general question, but I tried to use stargazer and other packages and I still cannot work my way around to build an advanced summary statistics table in R. I am working with the following dataset:
> str(df_All)
tibble [5,064 × 29] (S3: tbl_df/tbl/data.frame)
$ Net_IRR : num [1:5064] 15.9 1.75 46 20 18.4 ...
$ Age : num [1:5064] 1 1 1 1 1 1 1 1 1 1 ...
$ Ln_Age : num [1:5064] 0 0 0 0 0 0 0 0 0 0 ...
$ Fund_Sequence : num [1:5064] 1 1 1 1 1 1 1 1 1 1 ...
$ Ln_Fund_Sequence : num [1:5064] 0 0 0 0 0 0 0 0 0 0 ...
$ Fund_Size : num [1:5064] 50 46 423 96.9 81 ...
$ Ln_Fund_Size : num [1:5064] 3.91 3.83 6.05 4.57 4.39 ...
$ Nr_Funds : num [1:5064] 1 1 1 1 1 1 1 1 1 1 ...
$ HHI_Industry : num [1:5064] 0.427 0.243 0.36 0.333 1 ...
$ HHI_Region : num [1:5064] 1 1 1 1 1 ...
$ Stock_Market_Returns : num [1:5064] 0.11936 -0.00711 -0.00643 -0.03869 -0.01931 ...
$ GDP_Growth : num [1:5064] 0.0284 0.0245 0.0261 0.0304 0.0104 ...
$ Net_Multiple : num [1:5064] 3.3 1.09 4.04 2.73 1.95 ...
$ Ln_Fund_Size^2 : num [1:5064] 15.3 14.7 36.6 20.9 19.3 ...
$ Size_Q1 : num [1:5064] 41.5 42.5 123.8 109.8 85.5 ...
$ Size_Q2 : num [1:5064] 125.8 92.8 325.5 232 177.3 ...
$ Size_Q3 : num [1:5064] 211 206 756 624 302 ...
$ Size_Q4 : num [1:5064] 1000 1500 6114 5887 2600 ...
$ Size_Spline_1 : num [1:5064] 0 0 0 1 1 1 0 1 0 0 ...
$ Size_Spline_2 : num [1:5064] 1 1 0 0 0 0 0 0 1 0 ...
$ Size_Spline_3 : num [1:5064] 0 0 1 0 0 0 1 0 0 1 ...
$ Size_Spline_4 : num [1:5064] 0 0 0 0 0 0 0 0 0 0 ...
$ Dummy_First_Time_Fund: num [1:5064] 1 1 1 1 1 1 1 1 1 1 ...
$ Dummy_Industry : num [1:5064] 1 0 0 0 1 0 0 1 1 0 ...
$ Dummy_Region : num [1:5064] 1 1 1 1 1 1 1 1 1 1 ...
$ Fund_ID : num [1:5064] 8360 3491 5576 48689 6016 ...
$ Vintage_Year : num [1:5064] 2002 2004 2000 1997 2006 ...
$ Asset_Class : chr [1:5064] "Venture Capital" "Venture Capital" "Private Equity" "Private Equity" ...
$ Region_Focus : chr [1:5064] "North America" "North America" "North America" "Europe" ...
I would like to build a summary statistics table with a Latex format. The data should be aggregated by the following vertical/horizontal groups/sub groups:
I hope my issue is clear and would highly appreciate any help!
The aimed output is something along these lines:
Upvotes: 0
Views: 322
Reputation: 2817
I recommend the datasummary
from modelsummary
package. You can split vertical and horizontal easily. Please provide a minimal example of your data, if you need more help. It would be easier to replicate what you ask for, when you provide the data.
library(modelsummary)
data(mtcars)
datasummary(factor(cyl) * (mpg + drat) ~ factor(vs)*(Mean + Min + Max + SD),
data = mtcars)
Upvotes: 1