How Not to Display a Data Frame

If you would like to display a data frame—tigerstats::m111survey, for example—in an R Markdown document, don’t do this:

m111survey

That will spill the whole data frame into the documents, in a very messy way.

How to Display a Data Frame

Instead, use the datable() function from the DT package, like this:

DT::datatable(m111survey,
              options = list(
                scrollX = TRUE
              ))

If your frame doesn’t have very many columns, then you might not need the scrollX option. In that case you can simplify your code:

DT::datatable(alcohol)  # from the tigerstats package

How Much to Show

You can set the choices for how many rows to show:

DT::datatable(m111survey,
              options = list(
                scrollX = TRUE,
                pageLength = 5,
                lengthMenu = c(5, 10, 15, 20)
              ))

Other Options

Study https://rstudio.github.io/DT/options.html for more options involving DT::datatable().