Skip to contents

Prints the specified number of rows of a data frame, followed by a row of ellipses. Useful for piping to knitr::kable() for printing a truncated table in a markdown document.

Usage

ellipses(df, n = 5L)

Arguments

df

A data frame.

n

The number of rows to show before an ellipses row.

Value

A data frame truncated by a row of ellipses.

Examples

ellipses(mtcars, 5)
#> # A tibble: 6 × 11
#>   mpg   cyl   disp  hp    drat  wt    qsec  vs    am    gear  carb 
#>   <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 21    6     160   110   3.9   2.62  16.46 0     1     4     4    
#> 2 21    6     160   110   3.9   2.875 17.02 0     1     4     4    
#> 3 22.8  4     108   93    3.85  2.32  18.61 1     1     4     1    
#> 4 21.4  6     258   110   3.08  3.215 19.44 1     0     3     1    
#> 5 18.7  8     360   175   3.15  3.44  17.02 0     0     3     2    
#> 6 ...   ...   ...   ...   ...   ...   ...   ...   ...   ...   ...