[R] using table in R
Bingshan Li
bli1 at bcm.tmc.edu
Sun Sep 17 04:17:21 CEST 2006
Hi there,
I have a dataframe whose elements are numbers or characters. I want
to extract the frequencies of each elements in the dataframe. For
example,
d = as.data.frame(matrix(c(1, 2, 3, 3), 2,2))
What I want is first what are the elements in the data (1,2,3 here)
and second what are their frequencies (1,1,2 respectively). How to
use "table" to extract these two pieces of information? I played with
"table" but couldn't extract the information. Please assume that we
do not know how many elements in the dataframe a priori.
Thanks a lot!
More information about the R-help
mailing list