msgWrap: msgWrap

View source: R/scorehelpers.R

msgWrapR Documentation

msgWrap

Description

Helps format line-wrapping of long error and warning messages

Usage

msgWrap(msg)

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.

Value

It returns msg formatted wrapped nicely for the console.

Examples

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))

raybaser/PROscorerTools documentation built on Oct. 17, 2023, 8:48 p.m.