Skip to content

Commit 1fb3c75

Browse files
Nj221102nitish jhajoshhwuuMichaelChirico
authored
Documentation for char.trunc('datatable.prettyprint.char') (#6005)
* 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]>
1 parent 821c8f9 commit 1fb3c75

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

man/print.data.table.Rd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
Key enhancements include automatic output compression of many observations and concise column-wise \code{class} summary.
1414

1515
\code{format_col} and \code{format_list_item} generics provide flexibility for end-users to define custom printing methods for generic classes.
16+
17+
Note also the option \code{datatable.prettyprint.char}; character columns entries exceeding this limit will be truncated, with \code{...} indicating the truncation.
1618
}
1719
\usage{
1820
\method{print}{data.table}(x,
@@ -98,6 +100,14 @@
98100
print(DT, trunc.cols=TRUE)
99101
options(old_width)
100102

103+
# `char.trunc` will truncate the strings if their lengths exceed the given limit: `datatable.prettyprint.char`
104+
# For example:
105+
106+
old = options(datatable.prettyprint.char=5L)
107+
DT = data.table(x=1:2, y=c("abcdefghij", "klmnopqrstuv"))
108+
DT
109+
options(old)
110+
101111
# Formatting customization
102112
format_col.complex = function(x, ...) sprintf('(\%.1f, \%.1fi)', Re(x), Im(x))
103113
x = data.table(z = c(1 + 3i, 2 - 1i, pi + 2.718i))

0 commit comments

Comments
 (0)