R Corrplot变量名称,其中整数位于前导位置

时间:2017-05-15 16:25:41

标签: r read.csv r-corrplot

在我的excel文件中,我的两个变量的名称是2B和3B,这意味着棒球中的双打和三重奏。但是,使用corrplot时,它显示为X2B和X3B。我认为这是因为它认为我想做乘法。我该如何解决这个问题?

我尝试将excel中的框从常规格式更改为文本。

非常感谢任何帮助。

修改

我弄清楚了这一部分。所以现在我有:

baseball = read.csv(file="MultComp3.csv",row.names=1)
library(corrplot)
M <- cor(baseball)[1:16,1:16]
colnames(M) <- c("Age","Runs\nPer\nGame","Hits","Doubles","Triples",
                   "Home Runs","RBI","Stolen\nBases","Walks","Strike\nOuts",
                   "Batting\nAverage","On-Base\nPercentage","Slugging\nPercentage","OPS","OPS+","Total\nBases")
rownames(M) <- c("Age","Runs\nPer\nGame","Hits","Doubles","Triples",
                 "Home Runs","RBI","Stolen\nBases","Walks","Strike\nOuts",
                 "Batting\nAverage","On-Base\nPercentage","Slugging\nPercentage","OPS","OPS+","Total\nBases")
corrplot.mixed(M)

编辑2:

但是现在,我需要让文字更小,因为它来自盒子。

enter image description here

0 个答案:

没有答案