Learn R Programming

bruceR (version 2023.9)

Print: Print strings with rich formats and colors.

Description

Be frustrated with print() and cat()? Try Print()! Run examples to see what it can do.

Usage

Print(...)

Glue(...)

Value

Formatted text.

Arguments

...

Character strings enclosed by "{ }" will be evaluated as R code.

Character strings enclosed by "<< >>" will be printed as formatted and colored text.

Long strings are broken by line and concatenated together.

Leading whitespace and blank lines from the first and last lines are automatically trimmed.

Functions

  • Print(): Paste and print strings.

  • Glue(): Paste strings.

Details

Possible formats/colors that can be used in "<< >>" include:

(1) bold, italic, underline, reset, blurred, inverse, hidden, strikethrough;

(2) black, white, silver, red, green, blue, yellow, cyan, magenta;

(3) bgBlack, bgWhite, bgRed, bgGreen, bgBlue, bgYellow, bgCyan, bgMagenta.

See more details in glue::glue() and glue::glue_col().

Examples

Run this code
name = "Bruce"
Print("My name is <>>>.
       <>>>
       <>>>
       sqrt({x}) = <>", x=10)

Run the code above in your browser using DataLab