R GGALY中的错误:单位中的错误(tic#u pos.c,“mm”):&x27;x';和';单位';必须具有长度>;0

R GGALY中的错误:单位中的错误(tic#u pos.c,“mm”):&x27;x';和';单位';必须具有长度>;0,r,plot,ggally,R,Plot,Ggally,我正在尝试为我的数据集生成一个可以找到的绘图 共有13个属性,其中第13个属性为类。第一个属性就是ID,所以我想忽略它 我试图创建这样的图表,但我得到了一个错误 > ggpairs(wine[2:13], columns=2:12, + colour='q', lower=list(continuous='points'), + axisLabels='none', + upper=list(continuous='blank')) Erro

我正在尝试为我的数据集生成一个可以找到的绘图

共有13个属性,其中第13个属性为类。第一个属性就是ID,所以我想忽略它

我试图创建这样的图表,但我得到了一个错误

> ggpairs(wine[2:13], columns=2:12,
+         colour='q', lower=list(continuous='points'),
+         axisLabels='none',
+         upper=list(continuous='blank'))
Error in unit(tic_pos.c, "mm") : 'x' and 'units' must have length > 0

首先,列错误,然后颜色错误,这就是导致上述错误的原因:

代码应该如下所示,我将其拆分一点以使其更有意义:

#load data
wine <- read.csv("wine_nocolor.csv")
#remove first column
wine1 <- wine[2:13]
#The colour column needs to be of factor class
wine1$q <- factor(wine1$q)

library(GGally)
#and now you need to pick the correct columns i.e. from 1 to 11 as you don't 
#need the last column
ggpairs(wine1, columns=1:11,
        colour='q',lower=list(continuous='points'),
        axisLabels='none',
        upper=list(continuous='blank'))
#加载数据

好极了!谢谢类似地,我将对其应用kmeans并比较数据。谢谢你!乐意帮忙:)