| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/string_repr.R |
| 3 |
\name{string_repr} |
| 4 |
\alias{string_repr} |
| 5 |
\alias{string_repr.function} |
| 6 |
\alias{string_repr.data.frame} |
| 7 |
\alias{string_repr.matrix} |
| 8 |
\alias{string_repr.numeric} |
| 9 |
\alias{string_repr.default} |
| 10 |
\title{Short string representation for R objects} |
| 11 |
\usage{ |
| 12 |
string_repr(x, width = 32, ...) |
| 13 |
|
| 14 |
\method{string_repr}{`function`}(x, width = 32L, ...) |
| 15 |
|
| 16 |
\method{string_repr}{data.frame}(x, width = 32L, ...) |
| 17 |
|
| 18 |
\method{string_repr}{matrix}(x, width = 32L, ...) |
| 19 |
|
| 20 |
\method{string_repr}{numeric}(x, width = 32L, ...) |
| 21 |
|
| 22 |
\method{string_repr}{default}(x, width = 32L, ...) |
| 23 |
} |
| 24 |
\arguments{ |
| 25 |
\item{x}{Any \R object.} |
| 26 |
|
| 27 |
\item{width}{a scalar integer} |
| 28 |
|
| 29 |
\item{...}{passed on to methods} |
| 30 |
} |
| 31 |
\value{ |
| 32 |
a \code{scalar} character |
| 33 |
} |
| 34 |
\description{ |
| 35 |
This is inspired by the python function \code{repr} and produces a short |
| 36 |
string representation of any \R object that is suitable for logging and error |
| 37 |
messages. It is a generic so you can implement methods for custom S3 objects. |
| 38 |
} |
| 39 |
\examples{ |
| 40 |
string_repr(iris) |
| 41 |
string_repr(LETTERS) |
| 42 |
string_repr(LETTERS, 10) |
| 43 |
} |