I'm using R
data.table
package, and I've just found out that, when using :=
operator functional form, it apparently does the same if you place it between single quotes ('
), double quotes ("
) or diacritical "grave" marks (`).
I've tried to search in both R
and data.table
documentation/posts, but the only thing I find are topics about problems with strings with diacritics similar questions. I would like to make sure they actually work the same way, and if that's a data.table
thing or it's some R
property I didn't know.
Sorry if it has been asked before, but it that's the case I haven't been able to find it.
Thanks, everyone for your time.
This is not specific to data.table. Non-standard symbols in R need to be quoted, this includes operators: see The Language Definition.
See also help("'")
:
Identifiers consist of a sequence of letters, digits, the period (.) and the underscore.
...
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).
If you quote the function name in a function call, you can use either of these three types of quotes.