Message-ID: <22148058.post@talk.nabble.com>
Date: 2009-02-22T15:37:46Z
From: Ben Bolker
Subject: split/decompose lines
In-Reply-To: <e86892490902220509j45bb6e73w934bfcae7bb8ddfc@mail.gmail.com>
Mafalda Viana-2 wrote:
>
>
> I need to split (or decompose) one line into many lines using one field as
> a
> reference.
>
> I have a table with the following format:
>
> A B Frequency
> 23 3 2
> 24 2 5
> 25 1 3
>
>
olddata[rep(1:nrow(olddata),olddata$B),]
repeats the rows of the data frame the appropriate number
of times. The new Frequency column is trivial
(rep(1,sum(olddata$B))
Ben Bolker
--
View this message in context: http://www.nabble.com/split-decompose-lines-tp22146585p22148058.html
Sent from the R help mailing list archive at Nabble.com.