toString {base}R Documentation

toString Converts its Argument to a Character String

Description

This is a helper function for format. It converts its argument to a string. If the argument is a vector then its elements are concatenated with a , as a separator. Most methods should honor the width argument.

Usage

toString(x, ...)

## Default S3 method:
toString(x, width, ...)

Arguments

x The object to be converted.
width The returned value has at most width characters. The minimum value accepted is 6 and smaller values are taken as 6.
... Optional arguments for methods.

Details

The default method returns the first width - 4 characters of the result with .... appended, if the full result would use more than width characters.

Value

A character vector of length 1 is returned.

Author(s)

Robert Gentleman

See Also

format

Examples

x <- c("a", "b", "aaaaaaaaaaa")
toString(x)
toString(x, width=8)

[Package base version 2.1.0 Index]