Một cặp backticks là một cách để đề cập đến tên hoặc kết hợp các biểu tượng được dự trữ khác hoặc bất hợp pháp. Dành riêng cho những từ như if
là một phần của ngôn ngữ, trong khi bất hợp pháp bao gồm các kết hợp phi cú pháp như c a t
. Hai loại này, được bảo lưu và bất hợp pháp, được đề cập trong tài liệu R là non-syntactic names
.
Như vậy,
`c a t` <- 1 # is valid R
và
> `+` # is equivalent to typing in a syntactic function name
function (e1, e2) .Primitive("+")
Là một commenter đề cập, ?Quotes
có chứa một số thông tin về backtick, dưới 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’.
văn xuôi Đây là một ít khó khăn để phân tích cú pháp. Điều đó có nghĩa là R để phân tích một mã thông báo dưới dạng tên, nó phải là 1) một chuỗi các chữ số, dấu chấm và dấu gạch dưới, rằng 2) không phải là một từ dành riêng trong ngôn ngữ. Nếu không, để được phân tích cú pháp dưới dạng tên, bạn phải sử dụng các dấu gạch chéo ngược.
Ngoài ra kiểm tra ?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.
Bên cạnh đó, nâng cao R có một số ví dụ về cách backticks được sử dụng trong expressions, environments, và functions.
trợ giúp ("' ") có thể theo thứ tự – hrbrmstr
' help ("\' ")' hiển thị cùng một trang tài liệu là '?Báo giá', không hoàn toàn rõ ràng – Megatron
bị bỏ lỡ trong q. xin lỗi. nhưng đó là một lời giải thích tốt về những gì nó làm. – hrbrmstr