We need to install few packages for this Graph
install.packages(“circlize”)
install.packages(“readxl”) [ to read xlsx file]
install.packages(“dplyr”) [ for data manipulation ]
library(circlize)
library(readxl)
library(dplyr)
data<-read_excel("companies.xlsx")
CompanySamp<-data%>%
rename(Sales=`Sales ($billion)`,Profit=`Profits ($billion)`,Assets=`Assets ($billion)`,Market_Value=`Market Value ($billion)`)%>%
select(Company,Sales,Profit,Assets,Market_Value)%>%
arrange(desc(Market_Value))%>%
top_n(5)
## Selecting by Market_Value
We need matrix format to visualize the data as chord Diagram
Companies<-CompanySamp[,1]
CompanyDetails<-as.matrix(CompanySamp[,-1])
row.names(CompanyDetails)<-Companies$Company
chordDiagram(CompanyDetails)
CompanyDetails%>%chordDiagram(annotationTrack = c("grid","name"))