markfairbanks / tidytable

Tidy interface to 'data.table'
https://markfairbanks.github.io/tidytable/
Other
449 stars 33 forks source link

Print output in console in the same way as data.table #821

Closed yohei-h closed 3 weeks ago

yohei-h commented 3 weeks ago

I would like to output tidytable objects to the console in data.table format. Below is a sample code.

d <- iris

library(tidyverse)
library(tidytable)

# I would like to print the output this way (top 5 rows and bottom 5 rows)
# -------------------------------------------------------
iris %>% as.data.table()

# tidytable way (same as tibble, top 10 rows)
# -------------------------------------------------------
iris %>% as_tidytable()

I would appreciate it if someone could tell me the way if any.

markfairbanks commented 3 weeks ago

Printing like a tibble is the intended way for tidytables to be printed. If you want to print like a data.table you can use as.data.table() like you showed in your example code.

yohei-h commented 3 weeks ago

Thanks, @markfairbanks