[R] Problem with avoiding rep

Paul Smith phhs80 at gmail.com
Mon Nov 26 20:34:36 CET 2007


Dear All,

Suppose that you have the following data:

X	Frequency
1	3
4	2
3	4

To get a vector with all observations, one could use

data <- c(rep(1,3),rep(4,2),rep(3,4))

I am wondering whether there exists an easier way of doing this. Any ideas?

Thanks in advance,

Paul



More information about the R-help mailing list