2

I have an aggregated data frame after use of melt/dcast functions:

    Agency     potential_danger_x     potential_danger_y     danger_x     danger_y
    A                  165                    12.232            23          23.98
    B                   34                    43.98             12          12.43

Since I must create a presentation, I just cannot present the dataframe like this (sigh!). I've tried to find a way to get an HTML or TeX presentation like this:

                             potential danger                        danger
    Agency              x                       y                x            y
    A                  165                    12.232            23          23.98
    B                   34                    43.98             12          12.43

but I found no way. I don't expect that you do the work for me but I would greatly appreciate a little guidance about how to manage this issue or which package could help me.

JVALLEJO
  • 119
  • 1
  • 1
  • 12

2 Answers2

1

Use package stargazer:

install.package(stargazer)
require(stargazer)
stargazer(attitude, summary = FALSE)

The summary = FALSE, will present the data as is. The output is TeX, then you retype the headers, or insert another row.

Repmat
  • 690
  • 6
  • 19
  • Thank you @Repmat, unfortunately, it seems that there is no package that do all the work but your help was useful. – JVALLEJO Jul 15 '15 at 18:14
1

You may also want to have a look at this page: LINK which gives an overview of some other R packages which are useful for formating tables.

I personally like the xtable package.

Community
  • 1
  • 1
JReddig
  • 81
  • 1
  • 1
  • 7