Package messaging. May 27, 2018

Similar documents
Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package facerec. May 14, 2018

Package dbx. July 5, 2018

Package oec. R topics documented: May 11, Type Package

Package robotstxt. November 12, 2017

Package knitrprogressbar

Package docxtools. July 6, 2018

Package crossword.r. January 19, 2018

Package spark. July 21, 2017

Package repec. August 31, 2018

Package fastdummies. January 8, 2018

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package tidyimpute. March 5, 2018

Package available. November 17, 2017

Package calpassapi. August 25, 2018

Package validara. October 19, 2017

Package canvasxpress

Package tidytree. June 13, 2018

Package qualmap. R topics documented: September 12, Type Package

Package glue. March 12, 2019

Package projector. February 27, 2018

Package pmatch. October 19, 2018

Package comparedf. February 11, 2019

Package datasets.load

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package loggit. April 9, 2018

Package rbgm. May 18, 2018

Package ECctmc. May 1, 2018

Package farver. November 20, 2018

Package WordR. September 7, 2017

Package stapler. November 27, 2017

Package tidyselect. October 11, 2018

Package geogrid. August 19, 2018

Package modules. July 22, 2017

Package fastqcr. April 11, 2017

Package guardianapi. February 3, 2019

Package jpmesh. December 4, 2017

Package rsppfp. November 20, 2018

Package bupar. March 21, 2018

Package goodpractice

Package kdtools. April 26, 2018

Package taxizedb. June 21, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package gtrendsr. October 19, 2017

Package semver. January 6, 2017

Package widyr. August 14, 2017

Package ompr. November 18, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package postal. July 27, 2018

Package aws.transcribe

Package testit. R topics documented: June 14, 2018

Package utilsipea. November 13, 2017

Package catchr. R topics documented: December 30, Type Package. Title Catch, Collect, and Raise Conditions. Version 0.1.0

Package ecoseries. R topics documented: September 27, 2017

Package SEMrushR. November 3, 2018

Package githubinstall

Package keyholder. May 19, 2018

Package kirby21.base

Package datapasta. January 24, 2018

Package cancensus. February 4, 2018

Package sfdct. August 29, 2017

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package internetarchive

Package bisect. April 16, 2018

Package swatches. December 21, 2017

Package wrswor. R topics documented: February 2, Type Package

Package dkanr. July 12, 2018

Package geniusr. December 6, 2017

Package embed. November 19, 2018

Package spelling. December 18, 2017

Package memoise. April 21, 2017

Package cli. November 5, 2017

Package mdftracks. February 6, 2017

Package clipr. June 23, 2018

Package sfc. August 29, 2016

Package librarian. R topics documented:

Package styler. December 11, Title Non-Invasive Pretty Printing of R Code Version 1.0.0

Package filelock. R topics documented: February 7, 2018

Package assertr. R topics documented: February 23, Type Package

Package IRkernel. January 7, 2019

Package areal. December 31, 2018

Package ruler. February 23, 2018

Package wdman. January 23, 2017

Package essurvey. August 23, 2018

Package sessioninfo. June 21, 2017

Package statsdk. September 30, 2017

Package resumer. R topics documented: August 29, 2016

Package msgtools. March 2, 2017

Package TrafficBDE. March 1, 2018

Package shiny.router

Package deductive. June 2, 2017

Package vip. June 15, 2018

Package IATScore. January 10, 2018

Package routr. October 26, 2017

Package data.world. April 5, 2018

Package textrecipes. December 18, 2018

Package pkgbuild. October 16, 2018

Package autocogs. September 22, Title Automatic Cognostic Summaries Version 0.1.1

Package wikitaxa. December 21, 2017

Transcription:

Type Package Package messaging May 27, 2018 Title Conveniently Issue Messages, Warnings, and Errors Version 0.1.0 Description Provides tools for creating and issuing nicely-formatted text within R diagnostic messages and those messages given during warnings and errors. The formatting of the messages can be customized using templating features. Issues with singular and plural forms can be handled through specialized syntax. License MIT + file LICENSE URL https://github.com/rich-iannone/messaging BugReports https://github.com/rich-iannone/messaging/issues Depends R (>= 3.1.2) Imports dplyr (>= 0.7.4), glue (>= 1.2.0), magrittr, rlang (>= 0.2.0), stringr (>= 1.3.0) Encoding UTF-8 LazyData true ByteCompile true RoxygenNote 6.0.1 Suggests testthat, covr NeedsCompilation no Author Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190x>) Maintainer Richard Iannone <riannone@me.com> Repository CRAN Date/Publication 2018-05-27 16:34:19 UTC R topics documented: emit_error.......................................... 2 emit_message........................................ 3 emit_warning........................................ 4 1

2 emit_error Index 6 emit_error Stop function and provide associated messages Description Usage Stop the execution of the function in the parent environment and use a message body that can be formed from multiple text objects. If a single text object is provided then the warning message text will appear on a single line. If multiple text fragments are provided then they will be separated by newlines (in the order provided). Custom formatting is possible by providing a messaging template that uses the string expression scheme used in the glue package. emit_error(...,.format = NULL,.f_name = TRUE,.issue = TRUE) Arguments... a collection of string expressions and named arguments for string interpolation. Bare strings will be pasted together and separated by newlines. Named arguments are used to provide values for string interpolation in the message..format.f_name.issue Examples a format template for a message. If not provided, the default template of "{.f_name}: {text}" will be used. the name of the function that caused the error. If not provided, the function name will be obtained from the function call stack. a logical value that indicates whether an error should be issued at all. ## Not run: # Write a function that stops the function # with a message with the requested number # of info lines yield_an_error <- function(msgs) { if (msgs > 3) msgs <- 3 # Create some strings can serve as additional # info for the message message_components <- c("* message info 1", "* message info 2", "* message info 3") # Generate and emit a formatted message emit_error( "There (is/are) {number} thing(s) to note", message_components[1:msgs],

emit_message 3 } number = msgs,.format = "{.f_name} info: {text}") # When that function is called, a formatted # message will appear; here are some examples: yield_an_error(msgs = 3) #> Error: yield_an_error() info: There are 3 things to note #> * message info 3 yield_an_error(msgs = 2) #> Error: yield_an_error() info: There are 2 things to note yield_an_error(msgs = 1) #> Error: yield_an_error() info: There is 1 thing to note ## End(Not run) emit_message Provide a message with a consistent format Description Create a message using a message body that can be formed from multiple text objects. If a single text object is provided then the message will appear on a single line. If multiple text fragments are provided then they will be separated by newlines (in the order provided). Custom formatting is possible by providing a messaging template that uses the string expression scheme used in the glue package. Usage emit_message(...,.format = NULL,.f_name = TRUE,.issue = TRUE) Arguments... a collection of string expressions and named arguments for string interpolation. Bare strings will be pasted together and separated by newlines. Named arguments are used to provide values for string interpolation in the message..format.f_name.issue a format template for a message. If not provided, the default template of "{.f_name}: {text}" will be used. the name of the function that relates to the message. If not provided, the function name will be obtained from the function call stack. a logical value that indicates whether the message should be issued at all. This is to control for the verbosity of messages under certain circumstances.

4 emit_warning Examples # Write a function that yields a message with # the requested number of info lines yield_a_message <- function(msgs) { if (msgs > 3) msgs <- 3 # Create some strings can serve as additional # info for the message message_components <- c("* message info 1", "* message info 2", "* message info 3") # Generate and emit a formatted message emit_message( "There (is/are) {number} thing(s) to note", message_components[1:msgs], number = msgs,.format = "{.f_name} info: {text}") } # When that function is called, a formatted # message will appear; here are some examples: yield_a_message(msgs = 3) yield_a_message(msgs = 2) yield_a_message(msgs = 1) emit_warning Provide a warning with a consistent format Description Usage Create a warning using a message body that can be formed from multiple text objects. If a single text object is provided then the warning message text will appear on a single line. If multiple text fragments are provided then they will be separated by newlines (in the order provided). Custom formatting is possible by providing a messaging template that uses the string expression scheme used in the glue package. emit_warning(...,.format = NULL,.f_name = TRUE,.issue = TRUE) Arguments... a collection of string expressions and named arguments for string interpolation. Bare strings will be pasted together and separated by newlines. Named arguments are used to provide values for string interpolation in the message.

emit_warning 5.format.f_name.issue a format template for a message. If not provided, the default template of "{.f_name}: {text}" will be used. the name of the function that caused the warning. If not provided, the function name will be obtained from the function call stack. a logical value that indicates whether a warning should be issued at all. Examples ## Not run: # Write a function that yields a warning with # the requested number of info lines yield_a_warning <- function(msgs) { if (msgs > 3) msgs <- 3 # Create some strings can serve as additional # info for the message message_components <- c("* message info 1", "* message info 2", "* message info 3") # Generate and emit a formatted message emit_warning( "There (is/are) {number} thing(s) to note", message_components[1:msgs], number = msgs,.format = "{.f_name} info: {text}") } # When that function is called, a formatted # message will appear; here are some examples: yield_a_warning(msgs = 3) #> Warning message: #> yield_a_warning() info: There are 3 things to note #> * message info 3 yield_a_warning(msgs = 2) #> Warning message: #> yield_a_warning() info: There are 2 things to note yield_a_warning(msgs = 1) #> Warning message: #> yield_a_warning() info: There is 1 thing to note ## End(Not run)

Index emit_error, 2 emit_message, 3 emit_warning, 4 6