[R] Frequency table
Jess L
tszhenzhenj at hotmail.com
Thu Nov 24 04:25:31 CET 2011
Hi,
I think you can try the function rep().
Example:
# this means rep 1 once, 2 twice and 3 three times
> rep(c(1,2,3), c(1,2,3))
[1] 1 2 2 3 3 3
# this means rep "A", "B", "C", until it reaches length of 10
> rep(c("A","B","C"), length.out = 10)
[1] "A" "B" "C" "A" "B" "C" "A" "B" "C" "A"
you can try more example by type:
?rep
hope this helps~
--
View this message in context: http://r.789695.n4.nabble.com/Frequency-table-tp4101612p4102614.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list