setwd("C:/Users/mvx13/OneDrive - Texas State University/Hackathon_Rohit/00Thesis/Roundabout/Data")
dat1= read.csv("DatawithCluster_4cluster.csv")
names(dat1)
## [1] "Sev" "Yng" "Typ" "Fcl" "Lgh" "Ln" "Cnd"
## [8] "Cnt" "Cnf" "PSL" "Unt" "Act" "Tcd" "Wth"
## [15] "Cluster"
clus1= subset(dat1, Cluster==1)
dim(clus1)
## [1] 2453 15
clus2= subset(dat1, Cluster==2)
dim(clus2)
## [1] 1396 15
clus3= subset(dat1, Cluster==3)
dim(clus3)
## [1] 1301 15
clus4= subset(dat1, Cluster==4)
dim(clus4)
## [1] 1298 15
library(vtree)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.3
## Warning: package 'dplyr' was built under R version 4.3.3
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
clus1_selected <- clus1 %>%
dplyr::mutate(
Cnf = ifelse(Cnf == "Fail to yield", "Improper Action", "Other"),
Act = ifelse(Act == "Straight Ahead", "Entering/Leaving", "Other"),
Typ = ifelse(Typ == "Angle", "Turning", "Other")
) %>%
dplyr::select(Cnf, Act, Typ)
vtree(clus1_selected,"Cnf Act Typ",horiz=FALSE, title = "Cluster 1")

vtree(clus1_selected,"Act Cnf Typ",horiz=FALSE, title = "Cluster 1")
