Dear list,
I have the following dataset and want to know how many times each value occur
in each column.
>data
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] -100 -100 -100 0 0 0 0 0 0 -100
[2,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[3,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[4,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[5,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -50
[6,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[7,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[8,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[9,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[10,] -100 -100 -100 -50 -100 -100 -100 -100 -100 -100
[11,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[12,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[13,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[14,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[15,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[16,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[17,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[18,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
[19,] -100 -100 -100 0 0 0 0 0 0 -100
[20,] -100 -100 -100 -100 -100 -100 -100 -100 -100 -100
The result matrix should look like
-100 0 -50
[1] 20
[2] 20
[3] 20
[4] 17
[5] 18
[6] 18
[7] 18 and so on
[8]
[9]
[10]
How can I do this in R ?
Thanks alot for your help,
Tom
---------------------------------
Jämför pris på flygbiljetter och hotellrum:
http://shopping.yahoo.se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.