1. Pie Charts
userName <- c("Lam Wei Wei", "Zheng Da Shi", "Lin Da You", "Fei Gu Man", "Chen Kuang", "Wong wei yun")
salary <- c(8500, 9800, 12500, 15000, 8700, 7500)
jobPosition <- c("Staff", "Manger", "BOSS", "CEO", "Staff", "Staff")
bonus <- c(2300, 1350, 3285, 1035, 3285, 1035)
result <- matrix(salary,ncol=6, byrow=TRUE)
colnames(result) <- userName
rownames(result) <- "salary"
result
pie(result, labels = userName, main="Salary bar chart")
Output result:
Lam Wei Wei Zheng Da Shi Lin Da You Fei Gu Man Chen Kuang Wong wei yun
salary 8500 9800 12500 15000 8700 7500
2. 3D Pie Chart
library(plotrix)
result <- matrix(salary,ncol=6, byrow=TRUE)
colnames(result) <- userName
rownames(result) <- "salary"
result
pie3D(result, labels = userName, explode=0.1, main="Salary bar chart")