display_table: Display a dataset as a table

View source: R/display.R

display_tableR Documentation

Display a dataset as a table

Description

[Experimental]

This function displays a data frame as a html table using the reactable package. The top ten rows in the table are displayed with the options to click through or display all the rows. The ability to search for table content and sort columns is also available.

Usage

display_table(data, rows = nrow(data))

Arguments

data

A data frame containing the data to display.

rows

Number of rows to display as an integer with total row number as the default.

Value

A html table displaying the first page of the data limited to the specified number of rows.

Examples

suppressPackageStartupMessages({
  suppressWarnings({
    library(palmerpenguins)
    library(dplyr)
  })
})

# select top 5 heaviest penguins from each species on each island
heaviest_penguins <- penguins %>%
  select(species, island, body_mass_g) %>%
  group_by(species, island) %>%
  arrange(desc(body_mass_g)) %>%
  slice_head(n = 5) %>%
  ungroup()
heaviest_penguins

## Not run: 
# display table of penguin weights for each species on each island
display_table(heaviest_penguins)

## End(Not run)

gcfrench/store documentation built on May 17, 2024, 5:52 p.m.