How to plot pie chart in R from a table with relative Frequency?
问题 I am brand new to R. I need to plot a pie graph. Now I have tried my best but it's not generating a pie chart for me. Below is my code. socialIssue <- matrix(c(245,112,153,71,133,306),ncol=1,byrow=T) rownames(socialIssue) <- c("Housing","Transportation","Health Care","Education","Food","Other") colnames(socialIssue) <- c("Frequency") socialIssue <- as.table(socialIssue) socialIssue/sum(socialIssue) cols <- rainbow(nrow(socialIssue)) pie(socialIssue$Frequency, labels=paste0(round(socialIssue