R GG仅绘制5个图中的1个,然后出错
我在尝试绘制dat数据帧时遇到以下错误R GG仅绘制5个图中的1个,然后出错,r,ggplot2,R,Ggplot2,我在尝试绘制dat数据帧时遇到以下错误 library(GGally) library(ggplot2) dat = data.frame(a=rnorm(5) , b= rnorm(5) ,c =rnorm(5) , d=rnorm(5) , e= c(1,2,3,4,5)) dat a b c d e 1 0.21444531 1.9972134 2.1988103 -0.47624689 1 2 -0.3
library(GGally)
library(ggplot2)
dat = data.frame(a=rnorm(5) , b= rnorm(5) ,c =rnorm(5) , d=rnorm(5) , e= c(1,2,3,4,5))
dat
a b c d e
1 0.21444531 1.9972134 2.1988103 -0.47624689 1
2 -0.32468591 0.6007088 1.3124130 -0.78860284 2
3 0.09458353 -1.2512714 -0.2651451 -0.59461727 3
4 -0.89536336 -0.6111659 0.5431941 1.65090747 4
5 -1.31080153 -1.1854801 -0.4143399 -0.05402813 5
ggpairs(dat ,mapping=aes(color =e),upper=list(continuous=wrap("cor",size=2)), columns = c("a","b","c","d"))
错误:
$中的错误如果将
e
分解,则它将运行:
dat$e <- factor(dat$e)
ggpairs(dat,mapping=aes(color=e),upper=list(continuous=wrap("cor",size=2)), columns = c("a","b","c","d"))
如果将
e
分解,则它将运行:
dat$e <- factor(dat$e)
ggpairs(dat,mapping=aes(color=e),upper=list(continuous=wrap("cor",size=2)), columns = c("a","b","c","d"))