Below is the dataset. https://docs.google.com/spreadsheet/ccc?key=0AjmK45BP3s1ydEUxRWhTQW5RczVDZjhyell5dUV4YlE#gid=0
Code:
counts = table(finaldata$satjob, finaldata$degree) barplot(counts, xlab="Highest Degree after finishing 9-12th Grade",col = c("Dark Blue","Blueviolet","deepPink4","goldenrod"), legend =(rownames(counts)))
The below barplot is the result of the above code. https://docs.google.com/file/d/0BzmK45BP3s1yVkx5OFlGQk5WVE0/edit
Now, i want to create the plot for relative frequency table of "counts".
For creating a relative frequency table, I need the divide each cell of the column by the column total to get the relative frequency for that cell and so for others as well. How to go about doing it.
I have tried this formula counts/sum(counts) , but this is not working. counts[1:4]/sum(counts[1:4]), this gives me the relative frequency of the first column.
Help me obtain the same for other columns as well in the same table.