Chose variables
data1 <- read.table("D:/104/ML_R/WOW_data.csv",
header=TRUE, sep=",")
data1_M<-aggregate(cbind(math_1,math_2,math_3) ~school_3,data=data1,mean)
names(data1_M)<-c("school3","math_1_mean","math_2_mean","math_3_mean")
head(data1_M)
## school3 math_1_mean math_2_mean math_3_mean
## 1 101 488.8889 498.0000 507.8889
## 2 102 490.0000 501.0000 507.3333
## 3 103 482.2500 493.7500 501.0000
## 4 104 478.6250 488.0000 496.5000
## 5 105 484.1667 498.7500 507.9167
## 6 106 473.2857 489.5714 500.0000
Loading packages
library(plyr)
library(plotly)
3D code
data1_M$school3<-as.factor(data1_M$school3)
p1 <- plot_ly(data1_M, x = ~math_1_mean, y = ~math_2_mean, z = ~math_3_mean, color = ~school3) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = '3 grade'),
yaxis = list(title = '4 grade'),
zaxis = list(title = '5 grade')))