| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/shaft-.R |
| 3 |
\name{pillar_shaft} |
| 4 |
\alias{pillar_shaft} |
| 5 |
\alias{print.pillar_shaft} |
| 6 |
\alias{format.pillar_shaft} |
| 7 |
\alias{pillar_shaft.logical} |
| 8 |
\alias{pillar_shaft.numeric} |
| 9 |
\alias{pillar_shaft.Date} |
| 10 |
\alias{pillar_shaft.POSIXt} |
| 11 |
\alias{pillar_shaft.character} |
| 12 |
\alias{pillar_shaft.glue} |
| 13 |
\alias{pillar_shaft.list} |
| 14 |
\alias{pillar_shaft.factor} |
| 15 |
\alias{pillar_shaft.AsIs} |
| 16 |
\alias{pillar_shaft.default} |
| 17 |
\title{Column data} |
| 18 |
\usage{ |
| 19 |
pillar_shaft(x, ...) |
| 20 |
|
| 21 |
\method{print}{pillar_shaft}(x, width = NULL, ...) |
| 22 |
|
| 23 |
\method{format}{pillar_shaft}(x, width, ...) |
| 24 |
|
| 25 |
\method{pillar_shaft}{logical}(x, ...) |
| 26 |
|
| 27 |
\method{pillar_shaft}{numeric}(x, ..., sigfig = NULL) |
| 28 |
|
| 29 |
\method{pillar_shaft}{Date}(x, ...) |
| 30 |
|
| 31 |
\method{pillar_shaft}{POSIXt}(x, ...) |
| 32 |
|
| 33 |
\method{pillar_shaft}{character}(x, ..., min_width = NULL) |
| 34 |
|
| 35 |
\method{pillar_shaft}{glue}(x, ..., min_width = NULL, na_indent = 0L, shorten = NULL) |
| 36 |
|
| 37 |
\method{pillar_shaft}{list}(x, ...) |
| 38 |
|
| 39 |
\method{pillar_shaft}{factor}(x, ...) |
| 40 |
|
| 41 |
\method{pillar_shaft}{AsIs}(x, ...) |
| 42 |
|
| 43 |
\method{pillar_shaft}{default}(x, ...) |
| 44 |
} |
| 45 |
\arguments{ |
| 46 |
\item{x}{A vector to format} |
| 47 |
|
| 48 |
\item{...}{Arguments passed to methods.} |
| 49 |
|
| 50 |
\item{width}{Width for printing and formatting.} |
| 51 |
|
| 52 |
\item{sigfig}{Deprecated, use \code{\link[=num]{num()}} or \code{\link[=set_num_opts]{set_num_opts()}} on the data instead.} |
| 53 |
|
| 54 |
\item{min_width}{Deprecated, use \code{\link[=char]{char()}} or \code{\link[=set_char_opts]{set_char_opts()}} on the data instead.} |
| 55 |
|
| 56 |
\item{na_indent}{Indentation of \code{NA} values.} |
| 57 |
|
| 58 |
\item{shorten}{How to abbreviate the data if necessary: |
| 59 |
\itemize{ |
| 60 |
\item \code{"back"} (default): add an ellipsis at the end |
| 61 |
\item \code{"front"}: add an ellipsis at the front |
| 62 |
\item \code{"mid"}: add an ellipsis in the middle |
| 63 |
\item \code{"abbreviate"}: use \code{\link[=abbreviate]{abbreviate()}} |
| 64 |
}} |
| 65 |
} |
| 66 |
\description{ |
| 67 |
Internal class for formatting the data for a column. |
| 68 |
\code{pillar_shaft()} is a coercion method that must be implemented |
| 69 |
for your data type to display it in a tibble. |
| 70 |
|
| 71 |
This class comes with a default method for \code{\link[=print]{print()}} that calls \code{\link[=format]{format()}}. |
| 72 |
If \code{print()} is called without \code{width} argument, the natural width will be |
| 73 |
used when calling \code{format()}. |
| 74 |
Usually there's no need to implement this method for your subclass. |
| 75 |
|
| 76 |
Your subclass must implement \code{format()}, the default implementation just |
| 77 |
raises an error. |
| 78 |
Your \code{format()} method can assume a valid value for the \code{width} argument. |
| 79 |
} |
| 80 |
\details{ |
| 81 |
The default method will currently format via \code{\link[=format]{format()}}, |
| 82 |
but you should not rely on this behavior. |
| 83 |
} |
| 84 |
\examples{ |
| 85 |
pillar_shaft(1:3) |
| 86 |
pillar_shaft(1.5:3.5) |
| 87 |
pillar_shaft(NA) |
| 88 |
pillar_shaft(c(1:3, NA)) |
| 89 |
} |