Skip to content
Back to formatted view

Raw Message

Message-ID: <CAGC2kj6KX=keZseTj20j_H2-DgrK+XuSPKRFyPzFQRoDV0U7bg@mail.gmail.com>
Date: 2012-10-09T18:54:15Z
From: bibek sharma
Subject: Qustion about Creating a sequence of vector

Hello R User,
I have a data set where subject( Id)  are frequently measured. For
example, the size of the data set is 75 by 2 and has following
frequency distribution.

id    freq
1      30
2      20
3      25

I want to create a variable (say seq) containing sequential count for
each id. I mean variable seq should be as ( 1,2,..,30, 1,2,...,20,
1,2,...,25)

I use following code but did not work. Any suggestion is much appreciated..
sim<-rep(NA, 90)
for (i in 1:3){
d[i]<-seq(1,a[i,2],by=1)
sim[i]<-as.vector(c(d[i])
}

Thank you,
Bibek