Skip to contents

Takes a character string and builds a comment so it will be formatted as a section at the specified level in RStudio

Usage

FM_build_comment(level = 1, comment_str)

Arguments

level

Integer (1 (default),2, or 3) indicating the section level of the comment.

comment_str

Character object.

Value

Formatted comment.

Examples

FM_build_comment(1, "This is a level 1 header")
#> [1] "# This is a level 1 header ------------------------------------------------"

FM_build_comment(2, paste0(rep("Long string repeated.", 5), collapse=" "))
#> [1] "# Long string repeated. Long string repeated. Long string repeated. L ====="