escape | R Documentation |
escape()
requires you to provide a database connection to control the
details of escaping. escape_ansi()
uses the SQL 92 ANSI standard.
escape(x, parens = NA, collapse = " ", con = NULL)
escape_ansi(x, parens = NA, collapse = "")
sql_vector(x, parens = NA, collapse = " ", con = NULL)
x |
An object to escape. Existing sql vectors will be left as is,
character vectors are escaped with single quotes, numeric vectors have
trailing |
parens , collapse |
Controls behaviour when multiple values are supplied.
Default behaviour: lists are always wrapped in parens and separated by commas, identifiers are separated by commas and never wrapped, atomic vectors are separated by spaces and wrapped in parens if needed. |
con |
Database connection. |
# Doubles vs. integers
escape_ansi(1:5)
escape_ansi(c(1, 5.4))
# String vs known sql vs. sql identifier
escape_ansi("X")
escape_ansi(sql("X"))
escape_ansi(ident("X"))
# Escaping is idempotent
escape_ansi("X")
escape_ansi(escape_ansi("X"))
escape_ansi(escape_ansi(escape_ansi("X")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.