Printing and formatting corpus data frames.
# S3 method for corpus_frame print(x, rows = 20L, chars = NULL, digits = NULL, quote = FALSE, na.print = NULL, print.gap = NULL,right = FALSE, row.names = TRUE, max = NULL, display = TRUE, ...) # S3 method for corpus_frame format(x, chars = NULL, na.encode = TRUE, quote = FALSE, na.print = NULL, print.gap = NULL, ..., justify = "none")
x | data frame object to print or format. |
---|---|
rows | integer scalar giving the maximum number of rows to print before truncating the output. A negative or missing value indicates no upper limit. |
chars | maximum number of character units to display; see
|
digits | minimal number of significant digits; see
|
quote | logical scalar indicating whether to put surrounding
double-quotes ( |
na.print | character string (or |
print.gap | non-negative integer (or |
right | logical indicating whether to right-align columns (ignored for text, character, and factor columns). |
row.names | logical indicating whether to print row names, or a character vector giving alternate row names to display. |
max | maximum number of entries to print; defaults to
|
display | logical scalar indicating whether to optimize the
printing for display, not byte-for-byte data transmission;
see |
justify | justification; one of |
na.encode | logical scalar indicating whether to encode
|
... | further arguments passed to or from other methods. |
The "corpus_frame"
class is a subclass of "data.frame"
,
overriding the default print and format methods. To apply this
class to a data frame, set is class to
c("corpus_frame", "data.frame")
.
Corpus frame printing left-justifies character and text columns, truncates the output, and displays emoji on Mac OS.
corpus_frame
, print.data.frame
,
utf8_print
# default data frame printing x <- data.frame(text = c("hello world", intToUtf8(0x1f638 + 0:3), letters)) print(x)#> text #> 1 hello world #> 2 \U0001f638\U0001f639\U0001f63a\U0001f63b #> 3 a #> 4 b #> 5 c #> 6 d #> 7 e #> 8 f #> 9 g #> 10 h #> 11 i #> 12 j #> 13 k #> 14 l #> 15 m #> 16 n #> 17 o #> 18 p #> 19 q #> 20 r #> 21 s #> 22 t #> 23 u #> 24 v #> 25 w #> 26 x #> 27 y #> 28 z# corpus frame printing y <- x class(y) <- c("corpus_frame", "data.frame") print(y)#> text #> 1 hello world #> 2 ๐ธโ๐นโ๐บโ๐ปโ #> 3 a #> 4 b #> 5 c #> 6 d #> 7 e #> 8 f #> 9 g #> 10 h #> 11 i #> 12 j #> 13 k #> 14 l #> 15 m #> 16 n #> 17 o #> 18 p #> 19 q #> 20 r #> โฎ (28 rows total)print(y, 10) # change truncation limit#> text #> 1 hello world #> 2 ๐ธโ๐นโ๐บโ๐ปโ #> 3 a #> 4 b #> 5 c #> 6 d #> 7 e #> 8 f #> 9 g #> 10 h #> โฎ (28 rows total)