更新时间:2023-12-01 10:36:10
您误读了帮助文件。这是要看的论点:
You have misread the help file. Here's the argument to look at:
do.NULL
:合乎逻辑。如果 FALSE
并且名称为 NULL
,则会创建名称。
do.NULL
: logical. If FALSE
and names are NULL
, names are created.
请注意该说明中的和。您的名字不再是 NULL
,因此使用前缀将不起作用。
Notice the and in that description. Your names are no longer NULL
, so using prefix won't work.
相反,请使用以下内容:
Instead, use something like this:
> m2 <- cbind(1,1:4)
> colnames(m2) <- c("x","Y")
> colnames(m2) <- paste("Sub", colnames(m2), sep = "_")
> m2
Sub_x Sub_Y
[1,] 1 1
[2,] 1 2
[3,] 1 3
[4,] 1 4