Wrap text in curly quotes

quotes(..., type = c("double", "single"), curly = TRUE)

Arguments

...

Character. Text to go between curly quotes, and any other arguments to be passed to glue.

type

Character. Type of quotes: "single" or "double".

curly

Logical. Set to FALSE for straight quotes.

Value

Character. String surrounded in quotation marks.

quotes is a wrapper for glue, so you can use curly bracket notation and multiple character strings just like with glue.

Examples

library(glue) quotes("hello world")
#> “hello world”
quotes("hello world", type = "single")
#> ‘hello world’
quotes("hello ", "world", type = "single")
#> ‘hello world’
fname <- glue("I{enye()}igo") lname <- "Montoya" quotes("hello, my name is {fname} {lname}", type = "single")
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'fname' not found
quotes( "Hello, my name is {fname} {lname}. ", "You killed my father. Prepare to die." )
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'fname' not found
quotes( "Hello, my name is {fname} {lname}. ", "I'm boring, and I use straight quotes.", curly = FALSE )
#> Error in eval(parse(text = text, keep.source = FALSE), envir): object 'fname' not found