Learn R Programming

PROscorerTools (version 0.0.4)

msgWrap: msgWrap

Description

Helps format line-wrapping of long error and warning messages

Usage

msgWrap(msg)

Value

It returns msg formatted wrapped nicely for the console.

Arguments

msg

A quoted message.

Details

This is just a shorter version of the following that makes my function code easier to read: paste(strwrap(msg, exdent = 2, width = 70), collapse = "\n") It seems to work fine when embedded in warning or stop, but may give unexpected output if called alone.

Examples

Run this code
txt <- "If you use 'itemsrev' to indicate items that
        must be reverse-coded before scoring,
        you must provide a valid numeric range to 'minmax'.
        For example, if your lowest possible item response
        is 0 and your highest possible response is 4,
        you would use 'minmax = c(0, 4)'."

warning(msgWrap(msg = txt))

Run the code above in your browser using DataLab