Ok so I am imported the CSV file where I had all of my data.
The csv contained the following data. This was all in the excel spread sheet. It will be easy to understand.
SocialIssue Frequency RelFreq
1 Housing 245 0.2401961
2 Transportation 112 0.1098039
3 Health Care 153 0.1500000
4 Education 71 0.0696078
5 Food 133 0.1303922
6 Other 306 0.3000000
My "R" code. Here i just import the file and load the data. The data loads perfectly. But I don't know how to find the relative frequency from this. This is what i have so far.
data1 <- read.csv("C:/Users/jaina/Desktop/Question1CSV.csv", header = T)
table(data1$SocialIssue)/sum(data1$Frequency)
Now the above code turns out to be something like this:
Education Food Health Care Housing Other Transportation
0.001 0.001 0.001 0.001 0.001 0.001
The relative frequency is obviously not right but that's all i can think of..Any help would be appreciated.
UPDATE i ALSO want to create the pie chart of Social Issue vs RelRreq, now when i try this:
data1 <- read.csv("C:/Users/jaina/Desktop/Question1CSV.csv", header = T)
data1$RelFreq = data1$Frequency / sum(data1$Frequency)
options(digits = 6)
pie(data1)
It gives me the following error.
Error in pie(data1) : 'x' values must be positive