Comment out codes based on their languages.

comment_out(x, engine, extra_syntax = character(0L))

Arguments

x

A character vector

engine

A string that defines the engine of the x. See names(comment_syntax) for the predefined engines.

extra_syntax

A named character vector which defines extra syntax to comment out. Each values should contain %s which is the placeholder to insert x. If definitions collides among comment_syntax and extra_syntax, then the latter has priority.

See also

Examples

# Default behaviors comment_out("R language", "R")
#> [1] "# R language"
comment_out("Python language", "python")
#> [1] "# Python language"
# A customized behavior comment_out( "Python language", "python", extra_syntax = c("python" = '"""%s"""') )
#> [1] "\"\"\"Python language\"\"\""