[[
Una coppia di apici inversi è un modo per fare riferimento a nomi o combinazioni di simboli che sono altrimenti riservati o illegali. Riservato sono parole come if
fanno parte della lingua, mentre l'illegale include combinazioni non sintattiche come c a t
. Queste due categorie, riservate e illegali, sono indicate nella documentazione R come non-syntactic names
.
Così,
`c a t` <- 1 # is valid R
e
> `+` # is equivalent to typing in a syntactic function name
function (e1, e2) .Primitive("+")
Come commentatore accennato, ?Quotes
contiene alcune informazioni sul backtick, sotto Names and Identifiers:
Identifiers consist of a sequence of letters, digits, the period
(‘.’) and the underscore. They must not start with a digit nor
underscore, nor with a period followed by a digit. Reserved words
are not valid identifiers.
The definition of a _letter_ depends on the current locale, but
only ASCII digits are considered to be digits.
Such identifiers are also known as _syntactic names_ and may be
used directly in R code. Almost always, other names can be used
provided they are quoted. The preferred quote is the backtick
(‘`’), and ‘deparse’ will normally use it, but under many
circumstances single or double quotes can be used (as a character
constant will often be converted to a name). One place where
backticks may be essential is to delimit variable names in
formulae: see ‘formula’.
Questo prose è un po 'difficile analizzare. Ciò che significa è che per R analizzare un token come nome, deve essere 1) una sequenza di lettere, il punto e il trattino basso, che 2) non è una parola riservata nella lingua. Altrimenti, per essere analizzato come nome, è necessario utilizzare i backtick.
Verificate anche ?Reserved
:
Reserved words outside quotes are always parsed to be references
to the objects linked to in the ‘Description’, and hence they are
not allowed as syntactic names (see ‘make.names’). They *are*
allowed as non-syntactic names, e.g. inside backtick quotes.
Inoltre, Advanced R ha alcuni esempi di come vengono utilizzati in backticks expressions, environments e functions.
help ("' ") potrebbe essere nell'ordine – hrbrmstr
' help ("\" ")' richiama la stessa pagina doc di '?Quotes', che non era del tutto chiaro – Megatron
mancato che nel q. scuse. ma è una spiegazione decente di ciò che fa. – hrbrmstr