Skip to content

Commit

Permalink
Documentation for char.trunc('datatable.prettyprint.char') (#6005)
Browse files Browse the repository at this point in the history
* Documentation for char.trunc('datatable.prettyprint.char')

* small fix

* Mentioned trunc.char in 'print.data.table' function

* Improved explanation

* Update man/print.data.table.Rd

Co-authored-by: Joshua Wu <[email protected]>

* Update man/print.data.table.Rd

Co-authored-by: Joshua Wu <[email protected]>

* Update man/print.data.table.Rd

Co-authored-by: Joshua Wu <[email protected]>

* added description, deleted from alias, usage, args

* final touches

* removed name of private function

* removing space

* Final tweaks

---------

Co-authored-by: nitish jha <[email protected]>
Co-authored-by: Joshua Wu <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
  • Loading branch information
4 people authored Mar 16, 2024
1 parent 821c8f9 commit 1fb3c75
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions man/print.data.table.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
Key enhancements include automatic output compression of many observations and concise column-wise \code{class} summary.

\code{format_col} and \code{format_list_item} generics provide flexibility for end-users to define custom printing methods for generic classes.

Note also the option \code{datatable.prettyprint.char}; character columns entries exceeding this limit will be truncated, with \code{...} indicating the truncation.
}
\usage{
\method{print}{data.table}(x,
Expand Down Expand Up @@ -98,6 +100,14 @@
print(DT, trunc.cols=TRUE)
options(old_width)

# `char.trunc` will truncate the strings if their lengths exceed the given limit: `datatable.prettyprint.char`
# For example:

old = options(datatable.prettyprint.char=5L)
DT = data.table(x=1:2, y=c("abcdefghij", "klmnopqrstuv"))
DT
options(old)

# Formatting customization
format_col.complex = function(x, ...) sprintf('(\%.1f, \%.1fi)', Re(x), Im(x))
x = data.table(z = c(1 + 3i, 2 - 1i, pi + 2.718i))
Expand Down

0 comments on commit 1fb3c75

Please sign in to comment.