Package 'ARTofR'

Title: To Insert Title, Divider, and Block of Comments
Description: For instructions, check <https://github.com/Hzhang-ouce/ARTofR>. This is a wrapper of 'bannerCommenter', for inserting neat comments, headers and dividers.
Authors: Huanyuan Zhang [aut, cre]
Maintainer: Huanyuan Zhang <[email protected]>
License: MIT + file LICENSE
Version: 0.4.2
Built: 2025-02-26 03:29:57 UTC
Source: https://github.com/hzhang-ouce/artofr

Help Index


Convert sentences into a box of comments

Description

For user guide, please refer to https://github.com/Hzhang-ouce/ARTofR

Usage

xxx_box(mystring = NULL, center = FALSE)

xxx_box1(mystring = NULL, center = FALSE)

xxx_list(mystring = NULL, center = FALSE)

xxx_list1(mystring = NULL, center = FALSE)

Arguments

mystring

A string, will be a line of comment. If missing, the function will try to grab texts from your clipboard.

center

A logical value: Do you want the text strings centred? (alternative: left justified)

Details

xxx_box is for paragraph, xxx_list is for bullet points or numbered list.
Number 1 in xxx_box1 and xxx_list1 imply style 1.

Value

A character string vector returned invisibly, but automatically displayed in the console, the output will be saved into clipboard

Functions

  • xxx_box1: Same as xxx_box but add border

  • xxx_list: Same as xxx_box but looks better for bullet points list or numbered list

  • xxx_list1: Same as xxx_list but add border

Examples

# COMMON WORKFLOW OF THIS PACKAGE
#
# 1. To insert a box of comments etc with your own text
# 2. copy the text you want from anywhere
# 3. call xxx_box1() etc without arguments to grab text from clipboard
# 4. decorated text will be displayed and sent to clipboard, NO NEED to copy them
# 5. paste it into your R script
#...............................................
# # SPECIFIC USAGE EXAMPLE:

xxx_box('test sentence, test sentence, test sentence, test sentence',center = FALSE )
xxx_box1('test sentence, test sentence, test sentence, test sentence',center = FALSE )
xxx_box1('test sentence, test sentence, test sentence, test sentence',center = TRUE )

Insert a divider (line break or page break)

Description

For user guide, please refer to https://github.com/Hzhang-ouce/ARTofR

Usage

xxx_divider1(mystring = NULL)

xxx_divider2(mystring = NULL)

Arguments

mystring

the content of your break, must be one line only, not too long

Details

Divider is shorter than title for hierarchy purpose, title will be come a section (for folding) in Rstudio, but divider will not
There are two styles of break, xxx_divider1 and xxx_divider2
Please note that a super long divider string will result in an error
call xxx_divider1() will grab text from clipboard,
call xxx_divider1('') will make a line without text,
call xxx_divider1('mystring') will make a divider with 'mystring'

Value

A character string vector returned invisibly, but automatically displayed in the console, the output will be saved into clipboard

Functions

  • xxx_divider2: Same as xxx_divider1 but different style

Examples

# COMMON WORKFLOW OF THIS PACKAGE
#
# 1. To insert Dividers with your own text
# 2. copy the text you want from anywhere
# 3. call xxx_divider1() etc without arguments to grab text from clipboard
# 4. decorated text will be displayed and sent to clipboard, NO NEED to copy them
# 5. paste it into your R script
#...............................................
# # SPECIFIC USAGE EXAMPLE:

xxx_divider1('mystring')
xxx_divider1('')
xxx_divider2('mystring')
xxx_divider2('')

Insert a title

Description

For user guide, please refer to https://github.com/Hzhang-ouce/ARTofR

Usage

xxx_title1(mystring = NULL)

xxx_title0(mystring = NULL)

xxx_title2(mystring = NULL)

xxx_title3(mystring = NULL)

Arguments

mystring

the content of your title, must be one line only, not too long

Details

There are three levels of titles, inserting a title with xxx_title() will also add a section in Rstudio automatically.
Please note that a super long title string will result in an error
xxx_title0() was designed as the main title of the whole script
xxx_title1() is the largest header
xxx_title2() is the middle size header
xxx_title3() is the smallest header

Value

A character string vector returned invisibly, but automatically displayed in the console, the output will be saved into clipboard

Functions

  • xxx_title0: the middle size title

  • xxx_title2: the middle size title

  • xxx_title3: the smallest title

Examples

# COMMON WORKFLOW OF THIS PACKAGE
#
# 1. To insert titles with your own text
# 2. copy the text you want from anywhere
# 3. call xxx_title2() etc without arguments to grab text from clipboard
# 4. decorated text will be displayed and sent to clipboard, NO NEED to copy them
# 5. paste it into your R script
#...............................................
# # SPECIFIC USAGE EXAMPLE:

xxx_title0('my title')
xxx_title1('my title')
xxx_title2('my title')
xxx_title3('my title')