Learn R Programming

dreamerr (version 1.2.3)

fit_screen: Nicely fits a message in the current R console

Description

Utility to display long messages with nice formatting. This function cuts the message to fit the current screen width of the R console. Words are never cut in the middle.

Usage

fit_screen(msg, width = 0.9)

Value

It returns a single character vector with line breaks at the appropriate width.

Arguments

msg

Text message: character vector.

width

The maximum width of the screen the message should take. Default is 0.9.

Details

This function does not handle tabulations.

Examples

Run this code

cat(fit_screen(enumerate_items(state.name, nmax = Inf)))

cat(fit_screen(enumerate_items(state.name, nmax = Inf), 0.5))

Run the code above in your browser using DataLab