Hi, I have a question relating to R package If i have the frequencies of data as following 1 2 3 4 data 2 3 3 1 frequency Which command i can use to get the data set in the above example should be 1 2 3 4 Thanks Nada [[alternative HTML version deleted]]
Hi, I have a question relating to R package If i have the frequencies of data how i can get the data as following : 1 2 3 4 data 2 3 3 1 frequency Which command i can use to get the data set in the above example should be 1 1 2 2 2 3 3 3 4 Thanks Nada [[alternative HTML version deleted]]
> d <- 1:4 > f <- c(2,3,3,1) > rep(d,f)[1] 1 1 2 2 2 3 3 3 4 On Sat, Jul 10, 2010 at 10:55 PM, nn roh <nn.roh1 at gmail.com> wrote:> Hi, > > I have a question relating to R package > > If i ?have the frequencies of data ? how i can get the data ?as following : > > 1 2 3 4 ? ? ?data > 2 3 ?3 1 ? ? ?frequency > > Which command i can use to get the data set in the above example should be > ? ?1 1 ?2 2 2 3 3 3 ?4 > > > Thanks > Nada > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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. >
Is this what you want:> x <- c(1,2,2,2,3,3,3,4,4,5) > z <- table(x) > zx 1 2 3 4 5 1 3 3 2 1> as.integer(rep(names(z), z))[1] 1 2 2 2 3 3 3 4 4 5>On Sat, Jul 10, 2010 at 10:55 AM, nn roh <nn.roh1 at gmail.com> wrote:> Hi, > > I have a question relating to R package > > If i ?have the frequencies of data ? how i can get the data ?as following : > > 1 2 3 4 ? ? ?data > 2 3 ?3 1 ? ? ?frequency > > Which command i can use to get the data set in the above example should be > ? ?1 1 ?2 2 2 3 3 3 ?4 > > > Thanks > Nada > > ? ? ? ?[[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?