求教各位大神,这种错误是什么,怎么解决?
setwd("E:/dataanalysis")
cj <- read.csv("2.csv")
cj$cat <- factor(cj$cat)
summary(cj)
library(ggplot2)
ggplot(data=cj, mapping=aes(x=cj$m, y=cj$sd, colour=cj$cat, shape=cj$cat))+geom_point()
运行结果:
> setwd("E:/dataanalysis")
> cj <- read.csv("2.csv")
> cj$cat <- factor(cj$cat)
> summary(cj)
m ad cat
Min. : 24.73 Min. : 4.12 hs :14
1st Qu.: 74.27 1st Qu.:17.82 ls : 4
Median : 78.90 Median :21.76 lus:17
Mean : 79.26 Mean :21.69
3rd Qu.: 92.35 3rd Qu.:25.22
Max. :100.17 Max. :34.45
> library(ggplot2)
> ggplot(data=cj, mapping=aes(x=cj$m, y=cj$sd, colour=cj$cat, shape=cj$cat))+geom_point()
Error: Aesthetics must be either length 1 or the same as the data (35): x, y, colour, shape