Dear friends,

I have a table like this, I have A B C D ... levels, the first column
you see is just the index, and there are different numbers in the
table.

      A  B  C  D  ...
1    0   2   1   0
2    1   0   2   1
3    2   3   0   0
4    0   0   1   0
5    0   2   3   1
...

I want to calculate the frequencies or the percentages of the numbers
in every column.

How do I get a table like this, the first column is the levels of
numbers, and the numbers inside the table are the percentages. All the
percentages should add up to 1 in every column.

      A     B      C     D   ...
  0  0.2   0.3   0.1   0.1
  1  0.1   0.1   0.2   0.1
  2  0.1   0.2   0.2   0.2
  3  0.2   0.1   0.1   0
  ...

Thanks your help!

Kelvin

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to