Files
StatisticalAnalysisByR/1.Correllation.r

26 lines
402 B
R
Raw Normal View History

2022-11-10 17:55:09 +09:00
library(corrplot)
library(lattice)
a <- mtcars
a
mcor2 <- cor(mtcars$gear, mtcars$carb)
mcor2
xyplot(gear ~ carb, data = mtcars)
lm <- plot(mtcars$gear, mtcars$carb)
abline(lm(mtcars$gear~mtcars$carb))
mcor <- cor(mtcars)
mcor
round(mcor, 2)
corrplot(mcor)
plot(mtcars)
library(ggplot2)
qplot(gear, carb, data = mtcars)
cor(mtcars$wt, mtcars$mpg)
qplot(wt, mpg, data=mtcars, color=factor(carb))