I have a vector,
Marks : 10 10 10 20 20 20 20 20 30 30 10 10 40 40 40 40 50 50 50 50.
I need to find its frequency distribution. I can get it using the command :
marks<- c(10,10,10,20,20,20,20,20,30,30,10,10,40,40,40,40,50,50,50,50)
marks1<- cbind(table(marks))
Now, when i check the structure of table marks 1, it is only 1 column and not 2. So,how would I convert this table into a matix or a datframe and assign attributes so that the output has two columns like this:
Marks Freq.
10 5
20 5
30 2
40 4
50 4
Is there any way to convert the table's row names into a column itself while converting the table into a matrix/datframe?
Most of the answers I found here are about converting a table ( with predefined column names) to matrix/datframe.