从 R 中的列表名称中删除重音符 (`)
Removing grave accent (`) from the names of a list in R
我的列表 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.)
我的列表 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.)