How can i manipulate this code using perhaps a for-loop?
tbl1 <- table(Column1Name)
cbind(tbl1,prop.table(tbl1))
This code works well for one column but there is over 100 columns in the data set that I am working with at the moment so it is very inefficient for me to repeat this and change the column name etc. each time.
Any help would be greatly appreciated.
tbl1 <- table(Column1Name)
cbind(tbl1,prop.table(tbl1))
gives the count and percentage of each of the factors in each variable and I want to do this for all of my variables using a general code for all.