Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as_tidytable

Coerce an object to a data.table/tidytable


Description

A tidytable object is simply a data.table with nice printing features.

Note that all tidytable functions automatically convert data.frames & data.tables to tidytables in the background. As such this function will rarely need to be used by the user.

Usage

as_tidytable(
  x,
  ...,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  .keep_rownames = NULL
)

Arguments

x

An R object

...

Additional arguments to be passed to or from other methods.

.name_repair

Treatment of duplicate names. See ?vctrs::vec_as_names for options/details.

.keep_rownames

Default is FALSE. If TRUE, adds the input object's names as a separate column named "rn". .keep_rownames = "id" names the column "id" instead.

Examples

test_df <- data.frame(x = -2:2, y = c(rep("a", 3), rep("b", 2)))

test_df %>%
  as_tidytable()

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.