我有一个列表l
,它在输出中具有重音符号“`”。为什么我在某些变量中得到这个,而在其他变量中却没有?
l
$`AMLM12PAH037A-B`
Left.Gene.Symbols Right.Gene.Symbols
PCMTD1 0 1
STK31 3 0
$AMLOT120AT
Left.Gene.Symbols Right.Gene.Symbols
ARHGEF3 2 0
CD96 2 0
RALYL 12 0
TRIO 0 1
最佳答案
不能有无效的名称,在本例中,它是其中的 -
。如果这样做,您要么会像您的那样被反引号转换,要么会出现错误,具体取决于您的制作方式。
除其他限制外,您还不能以数字开头名称。
查看函数 check.names
和 make.names
来自R FAQ :
A syntactic name is a string the parser interprets as this type of expression. It consists of letters, numbers, and the dot and (for
versions of R at least 1.9.0) underscore characters, and starts with
either a letter or a dot not followed by a number. Reserved words are not syntactic names.An object name is a string associated with an object that is assigned in an expression either by having the object name on the left of an assignment operation or as an argument to the assign() function. It is usually a syntactic name as well, but can be any non-empty string if it is quoted (and it is always quoted in the
call to assign()).- An argument name is what appears to the left of the equals sign when supplying an argument in a function call (for example, f(trim=.5)). Argument names are also usually syntactic names, but again can be anything if they are quoted.
- An element name is a string that identifies a piece of an object (a component of a list, for example.) When it is used on the right of the ‘$’ operator, it must be a syntactic name, or quoted. Otherwise, element names can be any strings. (When an object is used as a database, as in a call to eval() or attach(), the element names become object names.)
关于从 R 列表名称中删除重音符号 (`),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34224355/