Convert an R object to character and add back quotations.

back_quote(x, recursive = TRUE, as_double = TRUE)

Arguments

x

An R object.

recursive

Optional. TRUE or FALSE which indicates if to back quote each item of x or to back quote x as a whole, when x is a vector. The default value is TRUE.

as_double

Optional. TRUE or FALSE which indicates if to differentiate between type double and integer. The default value is TRUE, which means integers are handled as doubles.

Value

A character vector.

Examples

back_quote(1:3)
#> [1] "`1`" "`2`" "`3`"

back_quote(1:3, recursive = FALSE)
#> [1] "`1:3`"

back_quote(1:3, as_double = FALSE)
#> [1] "`1L`" "`2L`" "`3L`"

back_quote(NULL)
#> [1] "`NULL`"

back_quote(list(c, 1:3, "a"))
#> [1] "`.Primitive(\"c\")`" "`1:3`"               "`\"a\"`"