dt_row_to_string {DIZtools}R Documentation

Get the content of a data.table row in print-ready format.

Description

Create string of the content of a data.table row in print-ready format.

Usage

dt_row_to_string(dt, row = 1, sep = ", ", collapse = ": ", quote = "'")

Arguments

dt

(data.table) The input data.table.

row

(int, Optional) Row id to be used. Defaults to 1.

sep

a character string to separate the terms. Not NA_character_.

collapse

an optional character string to separate the results. Not NA_character_.

quote

(character, Optional) A quote parameter to be applied to all values of the rows.

Value

A character string. To print the result, simply forward it to print: dt |> dt_row_to_string()

Examples

  data.table::data.table(name = "Alice",
                         dob = as.POSIXct("1980-01-01"),
                         sex = "f") |>
    DIZtools::dt_row_to_string()

[Package DIZtools version 1.0.1 Index]