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

print.corpus_frame

Corpus Data Frame Printing


Description

Printing and formatting corpus data frames.

Usage

## S3 method for class '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 class 'corpus_frame'
format(x, chars = NULL, na.encode = TRUE, quote = FALSE,
       na.print = NULL, print.gap = NULL, ..., justify = "none")

Arguments

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 utf8_format.

digits

minimal number of significant digits; see print.default.

quote

logical scalar indicating whether to put surrounding double-quotes ('"') around character strings and escape internal double-quotes.

na.print

character string (or NULL) indicating the encoding for NA values. Ignored when na.encode is FALSE.

print.gap

non-negative integer (or NULL) giving the number of spaces in gaps between columns; set to NULL or 1 for a single space.

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 getOption("max.print").

display

logical scalar indicating whether to optimize the printing for display, not byte-for-byte data transmission; see utf8_encode.

justify

justification; one of "left", "right", "centre", or "none". Can be abbreviated.

na.encode

logical scalar indicating whether to encode NA values as character strings.

...

further arguments passed to or from other methods.

Details

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.

See Also

Examples

# default data frame printing
x <- data.frame(text = c("hello world", intToUtf8(0x1f638 + 0:3), letters))
print(x)

# corpus frame printing
y <- x
class(y) <- c("corpus_frame", "data.frame")
print(y)

print(y, 10) # change truncation limit

corpus

Text Corpus Analysis

v0.10.2
Apache License (== 2.0) | file LICENSE
Authors
Leslie Huang [cre, ctb], Patrick O. Perry [aut, cph], Finn Årup Nielsen [cph, dtc] (AFINN Sentiment Lexicon), Martin Porter and Richard Boulton [ctb, cph, dtc] (Snowball Stemmer and Stopword Lists), The Regents of the University of California [ctb, cph] (Strtod Library Procedure), Carlo Strapparava and Alessandro Valitutti [cph, dtc] (WordNet-Affect Lexicon), Unicode, Inc. [cph, dtc] (Unicode Character Database)
Initial release

We don't support your browser anymore

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